Re: [Mesa-dev] [PATCH 1/5] i965: Define HW-binding table and resource streamer control opcodes

2015-05-20 Thread Abdiel Janulgue


On 05/20/2015 09:47 AM, Pohjolainen, Topi wrote:
> On Wed, May 20, 2015 at 09:32:06AM +0300, Abdiel Janulgue wrote:
>> Reviewed-by: Topi Pohjolainen 
>> Signed-off-by: Abdiel Janulgue 
>> ---
>>  src/mesa/drivers/dri/i965/brw_defines.h | 24 
>>  src/mesa/drivers/dri/i965/intel_reg.h   |  3 +++
>>  2 files changed, 27 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
>> b/src/mesa/drivers/dri/i965/brw_defines.h
>> index dedc381..f151df1 100644
>> --- a/src/mesa/drivers/dri/i965/brw_defines.h
>> +++ b/src/mesa/drivers/dri/i965/brw_defines.h
>> @@ -1618,6 +1618,30 @@ enum brw_message_target {
>>  #define _3DSTATE_BINDING_TABLE_POINTERS_GS  0x7829 /* GEN7+ */
>>  #define _3DSTATE_BINDING_TABLE_POINTERS_PS  0x782A /* GEN7+ */
>>  
>> +#define _3DSTATE_BINDING_TABLE_POOL_ALLOC   0x7919 /* GEN7.5+ */
>> +#define BRW_HW_BINDING_TABLE_ENABLE_SHIFT   11 /* GEN7.5+ */
>> +#define BRW_HW_BINDING_TABLE_ENABLE_MASKINTEL_MASK(11, 11)
>> +#define BRW_HW_BINDING_TABLE_ON 1
>> +#define BRW_HW_BINDING_TABLE_OFF0
> 
> Could you explain why you chose not to use the simpler form I suggested?

I missed that out. I'll do the simpler form in the next revision

> 
>#define BRW_HW_BINDING_TABLE_ENABLE (1 << 11)
> 
>> +#define GEN7_HW_BT_MOCS_SHIFT   7
>> +#define GEN7_HW_BT_MOCS_MASKINTEL_MASK(10, 7)
>> +#define GEN8_HW_BT_MOCS_SHIFT   0
>> +#define GEN8_HW_BT_MOCS_MASKINTEL_MASK(6, 0)
>> +/* Only required in HSW */
>> +#define HSW_HW_BINDING_TABLE_RESERVED   (3 << 5)
>> +
>> +#define _3DSTATE_BINDING_TABLE_EDIT_VS  0x7843 /* GEN7.5 */
>> +#define _3DSTATE_BINDING_TABLE_EDIT_GS  0x7844 /* GEN7.5 */
>> +#define _3DSTATE_BINDING_TABLE_EDIT_HS  0x7845 /* GEN7.5 */
>> +#define _3DSTATE_BINDING_TABLE_EDIT_DS  0x7846 /* GEN7.5 */
>> +#define _3DSTATE_BINDING_TABLE_EDIT_PS  0x7847 /* GEN7.5 */
>> +#define BRW_BINDING_TABLE_INDEX_SHIFT   16
>> +#define BRW_BINDING_TABLE_INDEX_MASKINTEL_MASK(23, 16)
>> +
>> +#define BRW_BINDING_TABLE_EDIT_TARGET_ALL   3
>> +#define BRW_BINDING_TABLE_EDIT_TARGET_CORE1 2
>> +#define BRW_BINDING_TABLE_EDIT_TARGET_CORE0 1
>> +
>>  #define _3DSTATE_SAMPLER_STATE_POINTERS 0x7802 /* GEN6+ */
>>  # define PS_SAMPLER_STATE_CHANGE(1 << 12)
>>  # define GS_SAMPLER_STATE_CHANGE(1 << 9)
>> diff --git a/src/mesa/drivers/dri/i965/intel_reg.h 
>> b/src/mesa/drivers/dri/i965/intel_reg.h
>> index bd14e18..98adf45 100644
>> --- a/src/mesa/drivers/dri/i965/intel_reg.h
>> +++ b/src/mesa/drivers/dri/i965/intel_reg.h
>> @@ -47,6 +47,9 @@
>>  /* Load a value from memory into a register.  Only available on Gen7+. */
>>  #define GEN7_MI_LOAD_REGISTER_MEM   (CMD_MI | (0x29 << 23))
>>  # define MI_LOAD_REGISTER_MEM_USE_GGTT  (1 << 22)
>> +/* Haswell RS control */
>> +#define MI_RS_CONTROL   (CMD_MI | (0x6 << 23))
>> +#define MI_RS_STORE_DATA_IMM(CMD_MI | (0x2b << 23))
>>  
>>  /* Manipulate the predicate bit based on some register values. Only on 
>> Gen7+ */
>>  #define GEN7_MI_PREDICATE   (CMD_MI | (0xC << 23))
>> -- 
>> 1.9.1
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/5] i965: Enable hardware-generated binding tables on render path.

2015-05-20 Thread Abdiel Janulgue


On 05/20/2015 09:54 AM, Pohjolainen, Topi wrote:
> On Wed, May 20, 2015 at 09:32:08AM +0300, Abdiel Janulgue wrote:
>> This patch implements the binding table enable command which is also
>> used to allocate a binding table pool where where hardware-generated
>> binding table entries are flushed into. Each binding table offset in
>> the binding table pool is unique per each shader stage that are
>> enabled within a batch.
>>
>> Also insert the required brw_tracked_state objects to enable
>> hw-generated binding tables in normal render path.
>>
>> Signed-off-by: Abdiel Janulgue 
>> ---
>>  src/mesa/drivers/dri/i965/brw_binding_tables.c | 97 
>> ++
>>  src/mesa/drivers/dri/i965/brw_context.c|  4 ++
>>  src/mesa/drivers/dri/i965/brw_context.h|  6 ++
>>  src/mesa/drivers/dri/i965/brw_state.h  |  7 ++
>>  src/mesa/drivers/dri/i965/brw_state_upload.c   |  2 +
>>  src/mesa/drivers/dri/i965/intel_batchbuffer.c  |  4 ++
>>  6 files changed, 120 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c 
>> b/src/mesa/drivers/dri/i965/brw_binding_tables.c
>> index 98ff0dd..d8cb96d 100644
>> --- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
>> +++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
>> @@ -45,6 +45,23 @@
>>  #include "intel_batchbuffer.h"
>>  
>>  /**
>> + * We are required to start at this offset for binding table pointer state 
>> when
>> + * HW-generated binding table is enabled otherwise the GPU will hung. Note 
>> that
>> + * the binding table offsets are now relative to the binding tabe pool base
>> + * address instead of from the state batch.
>> + *
>> + * From the Bspec 3DSTATE_BINDING_TABLE_POINTERS_{PS/VS/GS/DS/HS} > Pointer 
>> to
>> + * PS Binding Table section lists the format as:
>> + *
>> + *  "SurfaceStateOffset[16:6]BINDING_TABLE_STATE*256 When
>> + *  HW-generated binding table is enabled"
>> + *
>> + * When HW-generated binding tables are enabled, Surface State Offsets are
>> + * 16-bit entries.
>> + */
>> +#define HW_BT_START_OFFSET 2 * 256;
> 
> Just checking that I'm reading this right, the multiplier two here is based
> on your experiments and it is not found in the spec?

It's in the spec. 2 is "BINDING_TABLE_STATE" which is 16-bits.

> 
>> +
>> +/**
>>   * Upload a shader stage's binding table as indirect state.
>>   *
>>   * This copies brw_stage_state::surf_offset[] into the indirect state 
>> section
>> @@ -170,6 +187,86 @@ const struct brw_tracked_state brw_gs_binding_table = {
>> .emit = brw_gs_upload_binding_table,
>>  };
>>  
>> +/**
>> + * Hardware-generated binding tables for the resource streamer
>> + */
>> +void
>> +gen7_disable_hw_binding_tables(struct brw_context *brw)
>> +{
>> +   BEGIN_BATCH(3);
>> +   OUT_BATCH(_3DSTATE_BINDING_TABLE_POOL_ALLOC << 16 | (3 - 2));
>> +   OUT_BATCH(SET_FIELD(BRW_HW_BINDING_TABLE_OFF, 
>> BRW_HW_BINDING_TABLE_ENABLE) |
>> + brw->is_haswell ? HSW_HW_BINDING_TABLE_RESERVED : 0);
>> +   OUT_BATCH(0);
>> +   ADVANCE_BATCH();
>> +
>> +   /* From the BSpec, 3D Pipeline > Resource Streamer > Hardware Binding
>> +* Tables > Programming note
>> +
>> +* "When switching between HW and SW binding table generation, SW must
>> +* issue a state cache invalidate."
>> +*/
>> +   brw_emit_pipe_control_flush(brw, PIPE_CONTROL_STATE_CACHE_INVALIDATE);
>> +}
>> +
>> +void
>> +gen7_enable_hw_binding_tables(struct brw_context *brw)
>> +{
>> +   if (!brw->has_resource_streamer) {
>> +  gen7_disable_hw_binding_tables(brw);
>> +  return;
>> +   }
>> +
>> +   if (!brw->hw_bt_pool.bo) {
>> +  /* We use a single re-usable buffer object for the lifetime of the
>> +   * context and size it to maximum allowed binding tables that can be
>> +   * programmed per batch:
>> +   *
>> +   * BSpec, 3D Pipeline > Resource Streamer > Hardware Binding Tables:
>> +   * "A maximum of 16,383 Binding tables are allowed in any batch 
>> buffer"
>> +   */
>> +  static const int max_size = 16383 * 4;
>> +  brw->hw_bt_pool.bo = drm_intel_bo_alloc(brw->bufmgr, "hw_bt",
>> +  max_size, 64);
>> +  brw->hw_bt_pool.next_offset = HW_BT_START_OFFSET;
>> +   }
>> +
>> +   uint32_t dw1 = SET_FIELD(BRW_HW_BINDING_TABLE_ON,
>> +BRW_HW_BINDING_TABLE_ENABLE);
>> +   if (brw->is_haswell)
>> +  dw1 |= SET_FIELD(GEN7_MOCS_L3, GEN7_HW_BT_MOCS) |
>> + HSW_HW_BINDING_TABLE_RESERVED;
>> +
>> +   BEGIN_BATCH(3);
>> +   OUT_BATCH(_3DSTATE_BINDING_TABLE_POOL_ALLOC << 16 | (3 - 2));
>> +   OUT_RELOC(brw->hw_bt_pool.bo, I915_GEM_DOMAIN_SAMPLER, 0, dw1);
>> +   OUT_RELOC(brw->hw_bt_pool.bo, I915_GEM_DOMAIN_SAMPLER, 0,
>> + brw->hw_bt_pool.bo->size);
>> +   ADVANCE_BATCH();
>> +
>> +   /* From the BSpec, 3D Pipeline > Resource Streamer > Hardware Binding
>> +* Tables > Programming note
>> +
>> +* "When switching between HW and SW binding table generation, SW

Re: [Mesa-dev] [PATCH 3/5] i965: Enable hardware-generated binding tables on render path.

2015-05-20 Thread Pohjolainen, Topi
On Wed, May 20, 2015 at 10:11:36AM +0300, Abdiel Janulgue wrote:
> 
> 
> On 05/20/2015 09:54 AM, Pohjolainen, Topi wrote:
> > On Wed, May 20, 2015 at 09:32:08AM +0300, Abdiel Janulgue wrote:
> >> This patch implements the binding table enable command which is also
> >> used to allocate a binding table pool where where hardware-generated
> >> binding table entries are flushed into. Each binding table offset in
> >> the binding table pool is unique per each shader stage that are
> >> enabled within a batch.
> >>
> >> Also insert the required brw_tracked_state objects to enable
> >> hw-generated binding tables in normal render path.
> >>
> >> Signed-off-by: Abdiel Janulgue 
> >> ---
> >>  src/mesa/drivers/dri/i965/brw_binding_tables.c | 97 
> >> ++
> >>  src/mesa/drivers/dri/i965/brw_context.c|  4 ++
> >>  src/mesa/drivers/dri/i965/brw_context.h|  6 ++
> >>  src/mesa/drivers/dri/i965/brw_state.h  |  7 ++
> >>  src/mesa/drivers/dri/i965/brw_state_upload.c   |  2 +
> >>  src/mesa/drivers/dri/i965/intel_batchbuffer.c  |  4 ++
> >>  6 files changed, 120 insertions(+)
> >>
> >> diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c 
> >> b/src/mesa/drivers/dri/i965/brw_binding_tables.c
> >> index 98ff0dd..d8cb96d 100644
> >> --- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
> >> +++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
> >> @@ -45,6 +45,23 @@
> >>  #include "intel_batchbuffer.h"
> >>  
> >>  /**
> >> + * We are required to start at this offset for binding table pointer 
> >> state when
> >> + * HW-generated binding table is enabled otherwise the GPU will hung. 
> >> Note that
> >> + * the binding table offsets are now relative to the binding tabe pool 
> >> base
> >> + * address instead of from the state batch.
> >> + *
> >> + * From the Bspec 3DSTATE_BINDING_TABLE_POINTERS_{PS/VS/GS/DS/HS} > 
> >> Pointer to
> >> + * PS Binding Table section lists the format as:
> >> + *
> >> + *"SurfaceStateOffset[16:6]BINDING_TABLE_STATE*256 When
> >> + *HW-generated binding table is enabled"
> >> + *
> >> + * When HW-generated binding tables are enabled, Surface State Offsets are
> >> + * 16-bit entries.
> >> + */
> >> +#define HW_BT_START_OFFSET 2 * 256;

There is also extra ; in the end.

> > 
> > Just checking that I'm reading this right, the multiplier two here is based
> > on your experiments and it is not found in the spec?
> 
> It's in the spec. 2 is "BINDING_TABLE_STATE" which is 16-bits.

Ah, okay, now I get the last two lines of the documentation. I would have
probably written it other way around then, 256 * 2 (num_elems * elem_size),
even as 256 * sizeof(uint16_t).

> 
> > 
> >> +
> >> +/**
> >>   * Upload a shader stage's binding table as indirect state.
> >>   *
> >>   * This copies brw_stage_state::surf_offset[] into the indirect state 
> >> section
> >> @@ -170,6 +187,86 @@ const struct brw_tracked_state brw_gs_binding_table = 
> >> {
> >> .emit = brw_gs_upload_binding_table,
> >>  };
> >>  
> >> +/**
> >> + * Hardware-generated binding tables for the resource streamer
> >> + */
> >> +void
> >> +gen7_disable_hw_binding_tables(struct brw_context *brw)
> >> +{
> >> +   BEGIN_BATCH(3);
> >> +   OUT_BATCH(_3DSTATE_BINDING_TABLE_POOL_ALLOC << 16 | (3 - 2));
> >> +   OUT_BATCH(SET_FIELD(BRW_HW_BINDING_TABLE_OFF, 
> >> BRW_HW_BINDING_TABLE_ENABLE) |
> >> + brw->is_haswell ? HSW_HW_BINDING_TABLE_RESERVED : 0);
> >> +   OUT_BATCH(0);
> >> +   ADVANCE_BATCH();
> >> +
> >> +   /* From the BSpec, 3D Pipeline > Resource Streamer > Hardware Binding
> >> +* Tables > Programming note
> >> +
> >> +* "When switching between HW and SW binding table generation, SW must
> >> +* issue a state cache invalidate."
> >> +*/
> >> +   brw_emit_pipe_control_flush(brw, PIPE_CONTROL_STATE_CACHE_INVALIDATE);
> >> +}
> >> +
> >> +void
> >> +gen7_enable_hw_binding_tables(struct brw_context *brw)
> >> +{
> >> +   if (!brw->has_resource_streamer) {
> >> +  gen7_disable_hw_binding_tables(brw);
> >> +  return;
> >> +   }
> >> +
> >> +   if (!brw->hw_bt_pool.bo) {
> >> +  /* We use a single re-usable buffer object for the lifetime of the
> >> +   * context and size it to maximum allowed binding tables that can be
> >> +   * programmed per batch:
> >> +   *
> >> +   * BSpec, 3D Pipeline > Resource Streamer > Hardware Binding Tables:
> >> +   * "A maximum of 16,383 Binding tables are allowed in any batch 
> >> buffer"
> >> +   */
> >> +  static const int max_size = 16383 * 4;
> >> +  brw->hw_bt_pool.bo = drm_intel_bo_alloc(brw->bufmgr, "hw_bt",
> >> +  max_size, 64);
> >> +  brw->hw_bt_pool.next_offset = HW_BT_START_OFFSET;
> >> +   }
> >> +
> >> +   uint32_t dw1 = SET_FIELD(BRW_HW_BINDING_TABLE_ON,
> >> +BRW_HW_BINDING_TABLE_ENABLE);
> >> +   if (brw->is_haswell)
> >> +  dw1 |= SET_FIELD(GEN7_MOCS_L3, GEN7_HW_BT_MOC

[Mesa-dev] [Bug 28130] vbo: premature flushing breaks GL_LINE_LOOP

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

Matt Turner  changed:

   What|Removed |Added

 QA Contact||mesa-dev@lists.freedesktop.
   ||org

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


[Mesa-dev] [Bug 25898] glEvalPoint causes glEnd to throw GL_INVALID_OPERATION

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

Matt Turner  changed:

   What|Removed |Added

 QA Contact||mesa-dev@lists.freedesktop.
   ||org

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


Re: [Mesa-dev] [PATCH 3/5] i965: Enable hardware-generated binding tables on render path.

2015-05-20 Thread Abdiel Janulgue


On 05/20/2015 10:21 AM, Pohjolainen, Topi wrote:
> On Wed, May 20, 2015 at 10:11:36AM +0300, Abdiel Janulgue wrote:
>>
>>
>> On 05/20/2015 09:54 AM, Pohjolainen, Topi wrote:
>>> On Wed, May 20, 2015 at 09:32:08AM +0300, Abdiel Janulgue wrote:
 This patch implements the binding table enable command which is also
 used to allocate a binding table pool where where hardware-generated
 binding table entries are flushed into. Each binding table offset in
 the binding table pool is unique per each shader stage that are
 enabled within a batch.

 Also insert the required brw_tracked_state objects to enable
 hw-generated binding tables in normal render path.

 Signed-off-by: Abdiel Janulgue 
 ---
  src/mesa/drivers/dri/i965/brw_binding_tables.c | 97 
 ++
  src/mesa/drivers/dri/i965/brw_context.c|  4 ++
  src/mesa/drivers/dri/i965/brw_context.h|  6 ++
  src/mesa/drivers/dri/i965/brw_state.h  |  7 ++
  src/mesa/drivers/dri/i965/brw_state_upload.c   |  2 +
  src/mesa/drivers/dri/i965/intel_batchbuffer.c  |  4 ++
  6 files changed, 120 insertions(+)

 diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c 
 b/src/mesa/drivers/dri/i965/brw_binding_tables.c
 index 98ff0dd..d8cb96d 100644
 --- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
 +++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
 @@ -45,6 +45,23 @@
  #include "intel_batchbuffer.h"
  
  /**
 + * We are required to start at this offset for binding table pointer 
 state when
 + * HW-generated binding table is enabled otherwise the GPU will hung. 
 Note that
 + * the binding table offsets are now relative to the binding tabe pool 
 base
 + * address instead of from the state batch.
 + *
 + * From the Bspec 3DSTATE_BINDING_TABLE_POINTERS_{PS/VS/GS/DS/HS} > 
 Pointer to
 + * PS Binding Table section lists the format as:
 + *
 + *"SurfaceStateOffset[16:6]BINDING_TABLE_STATE*256 When
 + *HW-generated binding table is enabled"
 + *
 + * When HW-generated binding tables are enabled, Surface State Offsets are
 + * 16-bit entries.
 + */
 +#define HW_BT_START_OFFSET 2 * 256;
> 
> There is also extra ; in the end.
> 
>>>
>>> Just checking that I'm reading this right, the multiplier two here is based
>>> on your experiments and it is not found in the spec?
>>
>> It's in the spec. 2 is "BINDING_TABLE_STATE" which is 16-bits.
> 
> Ah, okay, now I get the last two lines of the documentation. I would have
> probably written it other way around then, 256 * 2 (num_elems * elem_size),
> even as 256 * sizeof(uint16_t).

256 * sizeof(uint16_t) looks good! I'll do that in the next version.

Thanks,

> 
>>
>>>
 +
 +/**
   * Upload a shader stage's binding table as indirect state.
   *
   * This copies brw_stage_state::surf_offset[] into the indirect state 
 section
 @@ -170,6 +187,86 @@ const struct brw_tracked_state brw_gs_binding_table = 
 {
 .emit = brw_gs_upload_binding_table,
  };
  
 +/**
 + * Hardware-generated binding tables for the resource streamer
 + */
 +void
 +gen7_disable_hw_binding_tables(struct brw_context *brw)
 +{
 +   BEGIN_BATCH(3);
 +   OUT_BATCH(_3DSTATE_BINDING_TABLE_POOL_ALLOC << 16 | (3 - 2));
 +   OUT_BATCH(SET_FIELD(BRW_HW_BINDING_TABLE_OFF, 
 BRW_HW_BINDING_TABLE_ENABLE) |
 + brw->is_haswell ? HSW_HW_BINDING_TABLE_RESERVED : 0);
 +   OUT_BATCH(0);
 +   ADVANCE_BATCH();
 +
 +   /* From the BSpec, 3D Pipeline > Resource Streamer > Hardware Binding
 +* Tables > Programming note
 +
 +* "When switching between HW and SW binding table generation, SW must
 +* issue a state cache invalidate."
 +*/
 +   brw_emit_pipe_control_flush(brw, PIPE_CONTROL_STATE_CACHE_INVALIDATE);
 +}
 +
 +void
 +gen7_enable_hw_binding_tables(struct brw_context *brw)
 +{
 +   if (!brw->has_resource_streamer) {
 +  gen7_disable_hw_binding_tables(brw);
 +  return;
 +   }
 +
 +   if (!brw->hw_bt_pool.bo) {
 +  /* We use a single re-usable buffer object for the lifetime of the
 +   * context and size it to maximum allowed binding tables that can be
 +   * programmed per batch:
 +   *
 +   * BSpec, 3D Pipeline > Resource Streamer > Hardware Binding Tables:
 +   * "A maximum of 16,383 Binding tables are allowed in any batch 
 buffer"
 +   */
 +  static const int max_size = 16383 * 4;
 +  brw->hw_bt_pool.bo = drm_intel_bo_alloc(brw->bufmgr, "hw_bt",
 +  max_size, 64);
 +  brw->hw_bt_pool.next_offset = HW_BT_START_OFFSET;
 +   }
 +
 +   uint32_t dw1 = SET_FIELD(BRW_HW_BINDING_TABLE_ON,
>>

[Mesa-dev] [PATCH] freedreno/a3xx: set .zw of sprite coords to .01

2015-05-20 Thread Ilia Mirkin
Fixes non-determinism in bin/point-sprite rendering, and the stars on
the intro screen to neverball.

Cc: "10.6" 
Signed-off-by: Ilia Mirkin 
---
 src/gallium/drivers/freedreno/a3xx/fd3_program.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.c 
b/src/gallium/drivers/freedreno/a3xx/fd3_program.c
index a6824ef..57fcaa9 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_program.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.c
@@ -413,12 +413,15 @@ fd3_program_emit(struct fd_ringbuffer *ring, struct 
fd3_emit *emit,
}
}
 
-   /* TODO: Figure out if there's a way to make it spit 
out 0's and
-* 1's for the .z and .w components.
+   /* Replace the .xy coordinates with S/T from the point 
sprite. Set
+* interpolation bits for .zw such that they become .01
 */
-   if (emit->sprite_coord_enable & (1 << 
sem2idx(fp->inputs[j].semantic)))
+   if (emit->sprite_coord_enable & (1 << 
sem2idx(fp->inputs[j].semantic))) {
vpsrepl[inloc / 16] |= (emit->sprite_coord_mode 
? 0x0d : 0x09)
<< ((inloc % 16) * 2);
+   vinterp[(inloc + 2) / 16] |= 2 << (((inloc + 2) 
% 16) * 2);
+   vinterp[(inloc + 3) / 16] |= 3 << (((inloc + 3) 
% 16) * 2);
+   }
}
 
OUT_PKT0(ring, REG_A3XX_VPC_ATTR, 2);
-- 
2.3.6

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


Re: [Mesa-dev] [PATCH v2 12/15] nv50/ir: optimize the use of std::tr1::unordered_set

2015-05-20 Thread Petri Latvala

On 05/20/2015 06:30 AM, Ilia Mirkin wrote:

+typedef const iterator const_iterator;
+


This at least is wrong. A const iterator allows *iter = val, a 
const_iterator doesn't. A const_iterator allows ++, a const iterator 
doesn't.




--
Petri Latvala

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


Re: [Mesa-dev] [PATCH 3/6] softpipe: add textureOffset support.

2015-05-20 Thread Roland Scheidegger
I've got some nitpicks for the actual math performed for the offsets in 
some of the cases, but otherwise looks good. If it's slightly slower 
that's ok (initially I think the idea was to special purpose all these 
things into separate functions but this got a bit out of control with 
more and more stuff added to handle).


At least it is my understanding the actual order of things for texcoord 
wrapping should always be (or at least give the same results) 1. size 
mul, 2. int conversion, 3. offset add, 4. wrap.
I'm not entirely sure that real hw actually does things like that 
however for the more complicated modes (mirror etc.)...


Roland

On 05/20/2015 12:48 AM, Dave Airlie wrote:

From: Dave Airlie 

This was an oversight when GLSL1.30 was enabled, I think my
misunderstanding.

This fixes a bunch of tex-miplevel-selection tests under softpipe,
and is required for textureGather support.

I'm not sure this won't make sampling slowering, but its softpipe,
correctness first and all that.

Signed-off-by: Dave Airlie 
---
  src/gallium/drivers/softpipe/sp_tex_sample.c | 155 ---
  src/gallium/drivers/softpipe/sp_tex_sample.h |   4 +
  2 files changed, 97 insertions(+), 62 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c 
b/src/gallium/drivers/softpipe/sp_tex_sample.c
index a40a273..1a413a3 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -131,17 +131,17 @@ repeat(int coord, unsigned size)
   * \param icoord  returns the integer texcoords
   */
  static void
-wrap_nearest_repeat(float s, unsigned size, int *icoord)
+wrap_nearest_repeat(float s, unsigned size, int offset, int *icoord)
  {
 /* s limited to [0,1) */
 /* i limited to [0,size-1] */
 int i = util_ifloor(s * size);
-   *icoord = repeat(i, size);
+   *icoord = repeat(i + offset, size);
  }


  static void
-wrap_nearest_clamp(float s, unsigned size, int *icoord)
+wrap_nearest_clamp(float s, unsigned size, int offset, int *icoord)
  {
 /* s limited to [0,1] */
 /* i limited to [0,size-1] */
@@ -151,27 +151,32 @@ wrap_nearest_clamp(float s, unsigned size, int *icoord)
*icoord = size - 1;
 else
*icoord = util_ifloor(s * size);
+   if (offset)
+  *icoord = CLAMP(*icoord + offset, 0, size - 1);
  }


  static void
-wrap_nearest_clamp_to_edge(float s, unsigned size, int *icoord)
+wrap_nearest_clamp_to_edge(float s, unsigned size, int offset, int *icoord)
  {
 /* s limited to [min,max] */
 /* i limited to [0, size-1] */
 const float min = 1.0F / (2.0F * size);
 const float max = 1.0F - min;
+
 if (s < min)
*icoord = 0;
 else if (s > max)
*icoord = size - 1;
 else
*icoord = util_ifloor(s * size);
+   if (offset)
+  *icoord = CLAMP(*icoord + offset, 0, size - 1);
  }


  static void
-wrap_nearest_clamp_to_border(float s, unsigned size, int *icoord)
+wrap_nearest_clamp_to_border(float s, unsigned size, int offset, int *icoord)
  {
 /* s limited to [min,max] */
 /* i limited to [-1, size] */
@@ -183,11 +188,13 @@ wrap_nearest_clamp_to_border(float s, unsigned size, int 
*icoord)
*icoord = size;
 else
*icoord = util_ifloor(s * size);
+   if (offset)
+  *icoord = CLAMP(*icoord + offset, 0, size - 1);
  }


That's not quite right, that would never return a border texel anymore.
The offset probably just needs to be added before the if/else logic (as 
float). (I believe that logic is mostly there so the float->int 
conversion doesn't overflow, since otherwise it wouldn't really make a 
difference when doing the actual lookup with border, though I don't 
think we really ensure that for other modes so probably could actually 
ditch any clamping...)






  static void
-wrap_nearest_mirror_repeat(float s, unsigned size, int *icoord)
+wrap_nearest_mirror_repeat(float s, unsigned size, int offset, int *icoord)
  {
 const float min = 1.0F / (2.0F * size);
 const float max = 1.0F - min;
@@ -201,11 +208,13 @@ wrap_nearest_mirror_repeat(float s, unsigned size, int 
*icoord)
*icoord = size - 1;
 else
*icoord = util_ifloor(u * size);
+   if (offset)
+  *icoord = CLAMP(*icoord + offset, 0, size - 1);
  }



This seems wrong too, offsets are added before doing wrap, so just 
clamping afterwards doesn't do the right thing.



  static void
-wrap_nearest_mirror_clamp(float s, unsigned size, int *icoord)
+wrap_nearest_mirror_clamp(float s, unsigned size, int offset, int *icoord)
  {
 /* s limited to [0,1] */
 /* i limited to [0,size-1] */
@@ -216,11 +225,13 @@ wrap_nearest_mirror_clamp(float s, unsigned size, int 
*icoord)
*icoord = size - 1;
 else
*icoord = util_ifloor(u * size);
+   if (offset)
+  *icoord = CLAMP(*icoord + offset, 0, size - 1);
  }


Same here.



  static void
-wrap_nearest_mirror_clamp_to_edge(float s, unsigned size, int *icoord)
+wrap_nearest_mirror_clamp_to_ed

Re: [Mesa-dev] [PATCH 6/6] softpipe: start adding gather support

2015-05-20 Thread Roland Scheidegger

Just one issue below, otherwise looks great.

Thanks for doing this, now only the explicit derivs are still 
fundamentally broken in softpipe sampling ;-).


Roland

On 05/20/2015 12:48 AM, Dave Airlie wrote:

From: Dave Airlie 

This adds both ARB_texture_gather and the enhanced gather
for ARB_gpu_shader5.

This passes all the piglit tests, it relies on the GLSL
lowering pass to make textureGatherOffsets work.

Signed-off-by: Dave Airlie 
---
  src/gallium/drivers/softpipe/sp_screen.c |   5 +-
  src/gallium/drivers/softpipe/sp_tex_sample.c | 267 +++
  src/gallium/drivers/softpipe/sp_tex_sample.h |   2 +
  3 files changed, 191 insertions(+), 83 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
b/src/gallium/drivers/softpipe/sp_screen.c
index b3bc177..a688d31 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -191,7 +191,9 @@ softpipe_get_param(struct pipe_screen *screen, enum 
pipe_cap param)
 case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_NATIVE;
 case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
+  return 4;
 case PIPE_CAP_TEXTURE_GATHER_SM5:
+  return 1;
 case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
 case PIPE_CAP_TEXTURE_QUERY_LOD:
 case PIPE_CAP_SAMPLE_SHADING:
@@ -206,8 +208,9 @@ softpipe_get_param(struct pipe_screen *screen, enum 
pipe_cap param)
 case PIPE_CAP_FAKE_SW_MSAA:
return 1;
 case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET:
+  return -32;
 case PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET:
-  return 0;
+  return 31;
 case PIPE_CAP_DRAW_INDIRECT:
return 1;

diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c 
b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 02f3b37..5504189 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -1476,6 +1476,60 @@ img_filter_1d_array_linear(struct sp_sampler_view 
*sp_sview,
rgba[TGSI_NUM_CHANNELS*c] = lerp(xw, tx0[c], tx1[c]);
  }

+/*
+ * Retrieve the gathered value, need to convert to the
+ * TGSI expected interface, and take component select
+ * and swizzling into account.
+ */
+static float get_gather_value(struct sp_sampler_view *sp_sview,
+  int chan_in, int comp_sel,
+  const float *tx[4])
+{
+   int chan;
+   unsigned swizzle;
+
+   switch (chan_in) {
+   case 0:
+   default:
+  chan = 2;
+  break;
+   case 1:
+  chan = 3;
+  break;
+   case 2:
+  chan = 1;
+  break;
+   case 3:
+  chan = 0;
+  break;
+   }
+
+   switch (comp_sel) {
+   case 0:
+   default:
+  swizzle = sp_sview->base.swizzle_r;
+  break;
+   case 1:
+  swizzle = sp_sview->base.swizzle_g;
+  break;
+   case 2:
+  swizzle = sp_sview->base.swizzle_b;
+  break;
+   case 3:
+  swizzle = sp_sview->base.swizzle_a;
+  break;
+   }
+
+   switch (swizzle) {
+   case PIPE_SWIZZLE_ZERO:
+  return 0.0;
+   case PIPE_SWIZZLE_ONE:
+  return 1.0;
+   default:
+  return tx[chan][swizzle];
+   }
+}
+

  static void
  img_filter_2d_linear(struct sp_sampler_view *sp_sview,
@@ -1508,11 +1562,18 @@ img_filter_2d_linear(struct sp_sampler_view *sp_sview,
 tx[2] = get_texel_2d(sp_sview, sp_samp, addr, x0, y1);
 tx[3] = get_texel_2d(sp_sview, sp_samp, addr, x1, y1);

-   /* interpolate R, G, B, A */
-   for (c = 0; c < TGSI_QUAD_SIZE; c++)
-  rgba[TGSI_NUM_CHANNELS*c] = lerp_2d(xw, yw,
-  tx[0][c], tx[1][c],
-  tx[2][c], tx[3][c]);
+   if (args->gather_only) {
+  for (c = 0; c < TGSI_QUAD_SIZE; c++)
+ rgba[TGSI_NUM_CHANNELS*c] = get_gather_value(sp_sview, c,
+  args->gather_comp,
+  tx);
+   } else {
+  /* interpolate R, G, B, A */
+  for (c = 0; c < TGSI_QUAD_SIZE; c++)
+ rgba[TGSI_NUM_CHANNELS*c] = lerp_2d(xw, yw,
+ tx[0][c], tx[1][c],
+ tx[2][c], tx[3][c]);
+   }
  }


@@ -1549,11 +1610,18 @@ img_filter_2d_array_linear(struct sp_sampler_view 
*sp_sview,
 tx[2] = get_texel_2d_array(sp_sview, sp_samp, addr, x0, y1, layer);
 tx[3] = get_texel_2d_array(sp_sview, sp_samp, addr, x1, y1, layer);

-   /* interpolate R, G, B, A */
-   for (c = 0; c < TGSI_QUAD_SIZE; c++)
-  rgba[TGSI_NUM_CHANNELS*c] = lerp_2d(xw, yw,
-  tx[0][c], tx[1][c],
-  tx[2][c], tx[3][c]);
+   if (args->gather_only) {
+  for (c = 0; c < TGSI_QUAD_SIZE; c++)
+ rgba[TGSI_NUM_CHANNELS*c] = get_gather_value(sp_sview, c,
+  args->gather_comp,
+  tx);
+   } else {
+  /*

[Mesa-dev] [PATCH V2] glsl: remove element_type() helper

2015-05-20 Thread Timothy Arceri
We now have is_array() and without_array() that make the
code much clearer and remove the need for this.

For all remaining calls to this we already knew that
the type was an array so returning a null wasn't adding any value.

v2: use without_array() in _mesa_ast_array_index_to_hir() and don't use
 without_array() in lower_clip_distance_visitor() as we want to make sure the
 array is 2D.
---
 src/glsl/ast_array_index.cpp |  2 +-
 src/glsl/ast_function.cpp|  8 
 src/glsl/ast_to_hir.cpp  |  9 -
 src/glsl/glsl_parser_extras.cpp  |  4 ++--
 src/glsl/glsl_types.cpp  |  2 +-
 src/glsl/glsl_types.h| 14 +-
 src/glsl/ir.cpp  |  4 ++--
 src/glsl/link_atomics.cpp|  2 +-
 src/glsl/link_varyings.cpp   |  2 +-
 src/glsl/linker.cpp  |  4 ++--
 src/glsl/lower_clip_distance.cpp |  8 
 11 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
index 481bba8..7a3f925 100644
--- a/src/glsl/ast_array_index.cpp
+++ b/src/glsl/ast_array_index.cpp
@@ -233,7 +233,7 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
* values *do* diverge, then the behavior of the operation requiring a
* dynamically uniform expression is undefined.
*/
-  if (array->type->element_type()->is_sampler()) {
+  if (array->type->without_array()->is_sampler()) {
 if (!state->is_version(130, 100)) {
if (state->es_shader) {
   _mesa_glsl_warning(&loc, state,
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index 7583613..1e77124 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -863,7 +863,7 @@ process_array_constructor(exec_list *instructions,
 
if (is_unsized_array) {
   constructor_type =
-glsl_type::get_array_instance(constructor_type->element_type(),
+glsl_type::get_array_instance(constructor_type->fields.array,
   parameter_count);
   assert(constructor_type != NULL);
   assert(constructor_type->length == parameter_count);
@@ -876,7 +876,7 @@ process_array_constructor(exec_list *instructions,
   ir_rvalue *result = ir;
 
   const glsl_base_type element_base_type =
- constructor_type->element_type()->base_type;
+ constructor_type->fields.array->base_type;
 
   /* Apply implicit conversions (not the scalar constructor rules!). See
* the spec quote above. */
@@ -896,10 +896,10 @@ process_array_constructor(exec_list *instructions,
 }
   }
 
-  if (result->type != constructor_type->element_type()) {
+  if (result->type != constructor_type->fields.array) {
 _mesa_glsl_error(loc, state, "type error in array constructor: "
  "expected: %s, found %s",
- constructor_type->element_type()->name,
+ constructor_type->fields.array->name,
  result->type->name);
  return ir_rvalue::error_value(ctx);
   }
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 193eb94..1609e5e 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -678,7 +678,7 @@ validate_assignment(struct _mesa_glsl_parse_state *state,
 * is handled by ir_dereference::is_lvalue.
 */
if (lhs_type->is_unsized_array() && rhs->type->is_array()
-   && (lhs_type->element_type() == rhs->type->element_type())) {
+   && (lhs_type->fields.array == rhs->type->fields.array)) {
   if (is_initializer) {
  return rhs;
   } else {
@@ -820,7 +820,7 @@ do_assignment(exec_list *instructions, struct 
_mesa_glsl_parse_state *state,
  var->data.max_array_access);
  }
 
- var->type = glsl_type::get_array_instance(lhs->type->element_type(),
+ var->type = glsl_type::get_array_instance(lhs->type->fields.array,
rhs->type->array_size());
  d->type = var->type;
   }
@@ -2330,8 +2330,7 @@ apply_image_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
   struct _mesa_glsl_parse_state *state,
   YYLTYPE *loc)
 {
-   const glsl_type *base_type =
-  (var->type->is_array() ? var->type->element_type() : var->type);
+   const glsl_type *base_type = var->type->without_array();
 
if (base_type->is_image()) {
   if (var->data.mode != ir_var_uniform &&
@@ -2855,7 +2854,7 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE 
loc,
 *  type and specify a size."
 */
if (earlier->type->is_unsized_array() && var->type->is_array()
-   && (var->type->element_type() == earlier->type->element_type())) {
+   && (var->type->fields.array == earlier->type->fields.array)) {
   /* FINISHME: This doesn't match the qualifiers on the two
* FINISHM

Re: [Mesa-dev] [PATCH v2 12/15] nv50/ir: optimize the use of std::tr1::unordered_set

2015-05-20 Thread Francisco Jerez
Ilia Mirkin  writes:

> Francisco, any opinion on this patch (as the resident C++ expert)? It
> seems a little odd. I'd just as soon skip this, and just use "using
> std::tr1::unordered_set" or "using std::unordered_set" as necessary in
> the next patch. But perhaps this is a common technique?
>
This seems really ugly to me.  I've given the patch a try and the single
instantiation that this patch saves is some 2.7 kB of the binary, some
0.1% of the size of nouveau_compiler alone and 0.03% of the size of the
DRI driver with my configuration.  IMHO the tiny saving in disk space
hardly justifies the additional complexity and giving up the type-safe
interface provided by the STL (except for the begin() and end() methods
you have overridden with correct types, which is a tiny fraction of the
unordered_set interface).

If this is required for compatibility reasons with old Android systems I
suggest you wrap it under a preprocessor conditional like:

#if __cplusplus >= 201103L
using std::unordered_set;
#elif building-on-old-android-version-with-broken-stlport
using my-funky-wrapper-for-std-unordered-set;
#else
using std::tr1::unordered_set;
#endif

> On Tue, May 19, 2015 at 11:25 PM, Chih-Wei Huang
>  wrote:
>> Instead of using unordered_set directly, the patch
>> changes to use unordered_set and adds a wrapper template class
>> to convert the iterators to the expected user-defined type.
>>
>> This avoid instantiating the template multiple times and make the object
>> code be smaller about 4KB.
>>
>> Signed-off-by: Chih-Wei Huang 
>> ---
>>  src/gallium/drivers/nouveau/codegen/nv50_ir.h  | 28 
>> +++---
>>  .../nouveau/codegen/nv50_ir_lowering_nvc0.cpp  |  4 ++--
>>  .../nouveau/codegen/nv50_ir_lowering_nvc0.h|  4 +---
>>  src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp |  5 ++--
>>  4 files changed, 30 insertions(+), 11 deletions(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h 
>> b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
>> index 529dcb9..f4d52b7 100644
>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
>> @@ -451,6 +451,28 @@ struct Storage
>>  #define NV50_IR_INTERP_OFFSET  (2 << 2)
>>  #define NV50_IR_INTERP_SAMPLEID(3 << 2)
>>
>> +typedef std::tr1::unordered_set voidptr_unordered_set;
>> +
>> +template 
>> +class ptr_unordered_set : public voidptr_unordered_set {
>> +  public:
>> +typedef voidptr_unordered_set _base;
>> +typedef _base::iterator _biterator;
>> +
>> +class iterator : public _biterator {
>> +  public:
>> +iterator(const _biterator & i) : _biterator(i) {}
>> +V *operator*() { return reinterpret_cast(*_biterator(*this)); }
>> +const V *operator*() const { return reinterpret_cast> *>(*_biterator(*this)); }
>> +};
>> +typedef const iterator const_iterator;
>> +
>> +iterator begin() { return _base::begin(); }
>> +iterator end() { return _base::end(); }
>> +const_iterator begin() const { return _base::begin(); }
>> +const_iterator end() const { return _base::end(); }
>> +};
>> +
>>  // do we really want this to be a class ?
>>  class Modifier
>>  {
>> @@ -583,10 +605,10 @@ public:
>>
>> static inline Value *get(Iterator&);
>>
>> -   std::tr1::unordered_set uses;
>> +   ptr_unordered_set uses;
>> std::list defs;
>> -   typedef std::tr1::unordered_set::iterator UseIterator;
>> -   typedef std::tr1::unordered_set::const_iterator UseCIterator;
>> +   typedef ptr_unordered_set::iterator UseIterator;
>> +   typedef ptr_unordered_set::const_iterator UseCIterator;
>> typedef std::list::iterator DefIterator;
>> typedef std::list::const_iterator DefCIterator;
>>
>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp 
>> b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
>> index b61f3c4..669d292 100644
>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
>> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
>> @@ -224,7 +224,7 @@ NVC0LegalizePostRA::findFirstUses(
>>const Instruction *texi,
>>const Instruction *insn,
>>std::list &uses,
>> -  std::tr1::unordered_set& visited)
>> +  ptr_unordered_set& visited)
>>  {
>> for (int d = 0; insn->defExists(d); ++d) {
>>Value *v = insn->getDef(d);
>> @@ -318,7 +318,7 @@ NVC0LegalizePostRA::insertTextureBarriers(Function *fn)
>> if (!uses)
>>return false;
>> for (size_t i = 0; i < texes.size(); ++i) {
>> -  std::tr1::unordered_set visited;
>> +  ptr_unordered_set visited;
>>findFirstUses(texes[i], texes[i], uses[i], visited);
>> }
>>
>> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h 
>> b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
>> index 260e101..17b6f6f 100644
>> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.h
>> +++ b/src/gallium/drivers/nouveau/codegen

[Mesa-dev] [PATCH 5/6] i965: Upload binding tables in hw-generated binding table format.

2015-05-20 Thread Abdiel Janulgue
When hardware-generated binding tables are enabled, use the hw-generated
binding table format when uploading binding table state.

Normally, the CS will will just consume the binding table pointer commands
as pipelined state. When the RS is enabled however, the RS flushes whatever
edited surface state entries of our on-chip binding table to the binding
table pool before passing the command on to the CS.

Note that the the binding table pointer offset is relative to the binding table
pool base address when resource streamer instead of the surface state base 
address.

Signed-off-by: Abdiel Janulgue 
---
 src/mesa/drivers/dri/i965/brw_binding_tables.c | 27 --
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c 
b/src/mesa/drivers/dri/i965/brw_binding_tables.c
index abcc3dd..512c9b4 100644
--- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
+++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
@@ -86,7 +86,12 @@ brw_upload_binding_table(struct brw_context *brw,
  return;
 
   stage_state->bind_bo_offset = 0;
-   } else {
+   }
+
+   /* If resource streamer is enabled, skip manual binding table upload */
+   if (!brw->hw_bt_pool.bo) {
+  /* CACHE_NEW_*_PROG */
+
   /* Upload a new binding table. */
   if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
  brw->vtbl.emit_buffer_surface_state(
@@ -103,15 +108,33 @@ brw_upload_binding_table(struct brw_context *brw,
   /* BRW_NEW_SURFACES and BRW_NEW_*_CONSTBUF */
   memcpy(bind, stage_state->surf_offset,
  prog_data->binding_table.size_bytes);
+   } else {
+  gen7_update_binding_table_from_array(brw, stage_state->stage,
+   stage_state->surf_offset,
+   prog_data->binding_table.size_bytes 
/
+   4);
}
 
brw->ctx.NewDriverState |= brw_new_binding_table;
 
if (brw->gen >= 7) {
+
+  if (brw->has_resource_streamer)
+ stage_state->bind_bo_offset = brw->hw_bt_pool.next_offset;
+
   BEGIN_BATCH(2);
   OUT_BATCH(packet_name << 16 | (2 - 2));
-  OUT_BATCH(stage_state->bind_bo_offset);
+  /* Align SurfaceStateOffset[16:6] format to [15:5] PS Binding Table field
+   * when hw-generated binding table is enabled.
+   */
+  OUT_BATCH(brw->has_resource_streamer ?
+(stage_state->bind_bo_offset >> 1) :
+stage_state->bind_bo_offset);
   ADVANCE_BATCH();
+
+  if (brw->has_resource_streamer)
+ brw->hw_bt_pool.next_offset += 
ALIGN(prog_data->binding_table.size_bytes,
+  64);
}
 }
 
-- 
1.9.1

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


[Mesa-dev] [PATCH 1/6] i965: Define HW-binding table and resource streamer control opcodes

2015-05-20 Thread Abdiel Janulgue
v2: Simply HW binding table bit definitions and magic constants (Topi)

Reviewed-by: Topi Pohjolainen 
Signed-off-by: Abdiel Janulgue 
---
 src/mesa/drivers/dri/i965/brw_defines.h | 28 
 src/mesa/drivers/dri/i965/intel_reg.h   |  3 +++
 2 files changed, 31 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
b/src/mesa/drivers/dri/i965/brw_defines.h
index dedc381..7379b14 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -1618,6 +1618,34 @@ enum brw_message_target {
 #define _3DSTATE_BINDING_TABLE_POINTERS_GS 0x7829 /* GEN7+ */
 #define _3DSTATE_BINDING_TABLE_POINTERS_PS 0x782A /* GEN7+ */
 
+#define _3DSTATE_BINDING_TABLE_POOL_ALLOC   0x7919 /* GEN7.5+ */
+#define BRW_HW_BINDING_TABLE_ENABLE (1 << 11)
+#define GEN7_HW_BT_MOCS_SHIFT   7
+#define GEN7_HW_BT_MOCS_MASKINTEL_MASK(10, 7)
+#define GEN8_HW_BT_MOCS_SHIFT   0
+#define GEN8_HW_BT_MOCS_MASKINTEL_MASK(6, 0)
+/* Only required in HSW */
+#define HSW_HW_BINDING_TABLE_RESERVED   (3 << 5)
+
+#define _3DSTATE_BINDING_TABLE_EDIT_VS  0x7843 /* GEN7.5 */
+#define _3DSTATE_BINDING_TABLE_EDIT_GS  0x7844 /* GEN7.5 */
+#define _3DSTATE_BINDING_TABLE_EDIT_HS  0x7845 /* GEN7.5 */
+#define _3DSTATE_BINDING_TABLE_EDIT_DS  0x7846 /* GEN7.5 */
+#define _3DSTATE_BINDING_TABLE_EDIT_PS  0x7847 /* GEN7.5 */
+#define BRW_BINDING_TABLE_INDEX_SHIFT   16
+#define BRW_BINDING_TABLE_INDEX_MASKINTEL_MASK(23, 16)
+
+#define BRW_BINDING_TABLE_EDIT_TARGET_ALL   3
+#define BRW_BINDING_TABLE_EDIT_TARGET_CORE1 2
+#define BRW_BINDING_TABLE_EDIT_TARGET_CORE0 1
+/* In HSW, when editing binding table entries to surface state offsets,
+ * the surface state offset is a 16-bit value aligned to 32 bytes. But
+ * Surface State Pointer in dword 2 is [15:0]. Right shift surf_offset
+ * by 5 bits so it won't disturb bit 16 (which is used as the binding
+ * table index entry), otherwise it would hang the GPU.
+ */
+#define HSW_SURFACE_STATE_EDIT_SHIFT5
+
 #define _3DSTATE_SAMPLER_STATE_POINTERS0x7802 /* GEN6+ */
 # define PS_SAMPLER_STATE_CHANGE   (1 << 12)
 # define GS_SAMPLER_STATE_CHANGE   (1 << 9)
diff --git a/src/mesa/drivers/dri/i965/intel_reg.h 
b/src/mesa/drivers/dri/i965/intel_reg.h
index bd14e18..98adf45 100644
--- a/src/mesa/drivers/dri/i965/intel_reg.h
+++ b/src/mesa/drivers/dri/i965/intel_reg.h
@@ -47,6 +47,9 @@
 /* Load a value from memory into a register.  Only available on Gen7+. */
 #define GEN7_MI_LOAD_REGISTER_MEM  (CMD_MI | (0x29 << 23))
 # define MI_LOAD_REGISTER_MEM_USE_GGTT (1 << 22)
+/* Haswell RS control */
+#define MI_RS_CONTROL   (CMD_MI | (0x6 << 23))
+#define MI_RS_STORE_DATA_IMM(CMD_MI | (0x2b << 23))
 
 /* Manipulate the predicate bit based on some register values. Only on Gen7+ */
 #define GEN7_MI_PREDICATE  (CMD_MI | (0xC << 23))
-- 
1.9.1

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


[Mesa-dev] [PATCH 6/6] i965: Disable resource streamer in BLORP

2015-05-20 Thread Abdiel Janulgue
Switch off hardware-generated binding tables and gather push
constants in the blorp. Blorp requires only a minimal set of
simple constants. There is no need for the extra complexity
to program a gather table entry into the pipeline.

Signed-off-by: Abdiel Janulgue 
---
 src/mesa/drivers/dri/i965/gen7_blorp.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index 2bdc82b..92ac1c4 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -794,6 +794,7 @@ gen7_blorp_exec(struct brw_context *brw,
}
depthstencil_offset = gen6_blorp_emit_depth_stencil_state(brw, params);
gen7_blorp_emit_depth_stencil_state_pointers(brw, depthstencil_offset);
+   gen7_disable_hw_binding_tables(brw);
if (params->use_wm_prog) {
   uint32_t wm_surf_offset_renderbuffer;
   uint32_t wm_surf_offset_texture = 0;
-- 
1.9.1

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


[Mesa-dev] [PATCH 2/6] i965: Pass resource streamer enable flags on batchbuffer start

2015-05-20 Thread Abdiel Janulgue
This is passed on the kernel to enable the resource streamer enable bit
on MI_BATCHBUFFER_START

Signed-off-by: Abdiel Janulgue 
---
 src/mesa/drivers/dri/i965/brw_context.h   | 1 +
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 8 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index abc11f6..3f8e59d 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1140,6 +1140,7 @@ struct brw_context
bool no_simd8;
bool use_rep_send;
bool scalar_vs;
+   bool has_resource_streamer;
 
/**
 * Some versions of Gen hardware don't do centroid interpolation correctly
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index ed659ed..a2a3a95 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -267,6 +267,11 @@ throttle(struct brw_context *brw)
}
 }
 
+/* Drop when RS headers get pulled to libdrm */
+#ifndef I915_EXEC_RESOURCE_STREAMER
+#define I915_EXEC_RESOURCE_STREAMER (1<<16)
+#endif
+
 /* TODO: Push this whole function into bufmgr.
  */
 static int
@@ -293,7 +298,8 @@ do_flush_locked(struct brw_context *brw)
   if (brw->gen >= 6 && batch->ring == BLT_RING) {
  flags = I915_EXEC_BLT;
   } else {
- flags = I915_EXEC_RENDER;
+ flags = I915_EXEC_RENDER |
+(brw->has_resource_streamer ? I915_EXEC_RESOURCE_STREAMER : 0);
   }
   if (batch->needs_sol_reset)
 flags |= I915_EXEC_GEN7_SOL_RESET;
-- 
1.9.1

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


[Mesa-dev] [PATCH 4/6] i965: Implement interface to edit binding table entries

2015-05-20 Thread Abdiel Janulgue
Unlike normal software binding tables where the driver has to manually
generate and fill a binding table array which are then uploaded to the
hardware, the resource streamer instead presents the driver with an option
to fill out slots for individual binding table indices. The hardware
accumulates the state for these combined edits which it then automatically
flushes to a binding table pool when the binding table pointer state
command is invoked.

v2: Clarify binding table edit bit aligment. (Topi)

Signed-off-by: Abdiel Janulgue 
---
 src/mesa/drivers/dri/i965/brw_binding_tables.c | 47 ++
 src/mesa/drivers/dri/i965/brw_state.h  |  9 +
 2 files changed, 56 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c 
b/src/mesa/drivers/dri/i965/brw_binding_tables.c
index ab9b533..abcc3dd 100644
--- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
+++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
@@ -61,6 +61,12 @@
  */
 static const uint32_t hw_bt_start_offset = 256 * sizeof(uint16_t);
 
+static const GLuint stage_to_bt_edit[MESA_SHADER_FRAGMENT + 1] = {
+   _3DSTATE_BINDING_TABLE_EDIT_VS,
+   _3DSTATE_BINDING_TABLE_EDIT_GS,
+   _3DSTATE_BINDING_TABLE_EDIT_PS,
+};
+
 /**
  * Upload a shader stage's binding table as indirect state.
  *
@@ -191,6 +197,47 @@ const struct brw_tracked_state brw_gs_binding_table = {
  * Hardware-generated binding tables for the resource streamer
  */
 void
+gen7_update_binding_table(struct brw_context *brw,
+  gl_shader_stage stage,
+  uint32_t index,
+  uint32_t surf_offset)
+{
+   assert(stage <= MESA_SHADER_FRAGMENT);
+
+   uint32_t dw2 = SET_FIELD(index, BRW_BINDING_TABLE_INDEX) |
+  (surf_offset >> HSW_SURFACE_STATE_EDIT_SHIFT);
+
+   BEGIN_BATCH(3);
+   OUT_BATCH(stage_to_bt_edit[stage] << 16 | (3 - 2));
+   OUT_BATCH(BRW_BINDING_TABLE_EDIT_TARGET_ALL);
+   OUT_BATCH(dw2);
+   ADVANCE_BATCH();
+}
+
+/**
+ * Hardware-generated binding tables for the resource streamer
+ */
+void
+gen7_update_binding_table_from_array(struct brw_context *brw,
+ gl_shader_stage stage,
+ const uint32_t* binding_table,
+ int size)
+{
+   uint32_t dw2 = 0;
+   assert(stage <= MESA_SHADER_FRAGMENT);
+
+   BEGIN_BATCH(size + 2);
+   OUT_BATCH(stage_to_bt_edit[stage] << 16 | size);
+   OUT_BATCH(BRW_BINDING_TABLE_EDIT_TARGET_ALL);
+   for (int i = 0; i < size; i++) {
+  dw2 = SET_FIELD(i, BRW_BINDING_TABLE_INDEX) |
+ (binding_table[i] >> HSW_SURFACE_STATE_EDIT_SHIFT);
+  OUT_BATCH(dw2);
+   }
+   ADVANCE_BATCH();
+}
+
+void
 gen7_disable_hw_binding_tables(struct brw_context *brw)
 {
BEGIN_BATCH(3);
diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
b/src/mesa/drivers/dri/i965/brw_state.h
index 622ce3f..51983f2 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -374,6 +374,15 @@ gen7_upload_constant_state(struct brw_context *brw,
bool active, unsigned opcode);
 
 void gen7_rs_control(struct brw_context *brw, int enable);
+
+void gen7_update_binding_table(struct brw_context *brw,
+   gl_shader_stage stage,
+   uint32_t index,
+   uint32_t surf_offset);
+void gen7_update_binding_table_from_array(struct brw_context *brw,
+  gl_shader_stage stage,
+  const uint32_t* binding_table,
+  int size);
 void gen7_enable_hw_binding_tables(struct brw_context *brw);
 void gen7_disable_hw_binding_tables(struct brw_context *brw);
 void gen7_reset_rs_pool_offsets(struct brw_context *brw);
-- 
1.9.1

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


[Mesa-dev] [PATCH 3/6] i965: Enable hardware-generated binding tables on render path.

2015-05-20 Thread Abdiel Janulgue
This patch implements the binding table enable command which is also
used to allocate a binding table pool where where hardware-generated
binding table entries are flushed into. Each binding table offset in
the binding table pool is unique per each shader stage that are
enabled within a batch.

Also insert the required brw_tracked_state objects to enable
hw-generated binding tables in normal render path.

v2: Clarify start of binding table pool offsets. (Topi)

Signed-off-by: Abdiel Janulgue 
---
 src/mesa/drivers/dri/i965/brw_binding_tables.c | 95 ++
 src/mesa/drivers/dri/i965/brw_context.c|  4 ++
 src/mesa/drivers/dri/i965/brw_context.h|  6 ++
 src/mesa/drivers/dri/i965/brw_state.h  |  6 ++
 src/mesa/drivers/dri/i965/brw_state_upload.c   |  2 +
 src/mesa/drivers/dri/i965/intel_batchbuffer.c  |  4 ++
 6 files changed, 117 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_binding_tables.c 
b/src/mesa/drivers/dri/i965/brw_binding_tables.c
index 98ff0dd..ab9b533 100644
--- a/src/mesa/drivers/dri/i965/brw_binding_tables.c
+++ b/src/mesa/drivers/dri/i965/brw_binding_tables.c
@@ -45,6 +45,23 @@
 #include "intel_batchbuffer.h"
 
 /**
+ * We are required to start at this offset for binding table pointer state when
+ * HW-generated binding table is enabled otherwise the GPU will hung. Note that
+ * the binding table offsets are now relative to the binding tabe pool base
+ * address instead of from the state batch.
+ *
+ * From the Bspec 3DSTATE_BINDING_TABLE_POINTERS_{PS/VS/GS/DS/HS} > Pointer to
+ * PS Binding Table section lists the format as:
+ *
+ * "SurfaceStateOffset[16:6]BINDING_TABLE_STATE*256 When
+ * HW-generated binding table is enabled"
+ *
+ * When HW-generated binding tables are enabled, Surface State Offsets are
+ * 16-bit entries.
+ */
+static const uint32_t hw_bt_start_offset = 256 * sizeof(uint16_t);
+
+/**
  * Upload a shader stage's binding table as indirect state.
  *
  * This copies brw_stage_state::surf_offset[] into the indirect state section
@@ -170,6 +187,84 @@ const struct brw_tracked_state brw_gs_binding_table = {
.emit = brw_gs_upload_binding_table,
 };
 
+/**
+ * Hardware-generated binding tables for the resource streamer
+ */
+void
+gen7_disable_hw_binding_tables(struct brw_context *brw)
+{
+   BEGIN_BATCH(3);
+   OUT_BATCH(_3DSTATE_BINDING_TABLE_POOL_ALLOC << 16 | (3 - 2));
+   OUT_BATCH(brw->is_haswell ? HSW_HW_BINDING_TABLE_RESERVED : 0);
+   OUT_BATCH(0);
+   ADVANCE_BATCH();
+
+   /* From the BSpec, 3D Pipeline > Resource Streamer > Hardware Binding
+* Tables > Programming note
+
+* "When switching between HW and SW binding table generation, SW must
+* issue a state cache invalidate."
+*/
+   brw_emit_pipe_control_flush(brw, PIPE_CONTROL_STATE_CACHE_INVALIDATE);
+}
+
+void
+gen7_enable_hw_binding_tables(struct brw_context *brw)
+{
+   if (!brw->has_resource_streamer) {
+  gen7_disable_hw_binding_tables(brw);
+  return;
+   }
+
+   if (!brw->hw_bt_pool.bo) {
+  /* We use a single re-usable buffer object for the lifetime of the
+   * context and size it to maximum allowed binding tables that can be
+   * programmed per batch:
+   *
+   * BSpec, 3D Pipeline > Resource Streamer > Hardware Binding Tables:
+   * "A maximum of 16,383 Binding tables are allowed in any batch buffer"
+   */
+  static const int max_size = 16383 * 4;
+  brw->hw_bt_pool.bo = drm_intel_bo_alloc(brw->bufmgr, "hw_bt",
+  max_size, 64);
+  brw->hw_bt_pool.next_offset = hw_bt_start_offset;
+   }
+
+   uint32_t dw1 = BRW_HW_BINDING_TABLE_ENABLE;
+   if (brw->is_haswell)
+  dw1 |= SET_FIELD(GEN7_MOCS_L3, GEN7_HW_BT_MOCS) |
+ HSW_HW_BINDING_TABLE_RESERVED;
+
+   BEGIN_BATCH(3);
+   OUT_BATCH(_3DSTATE_BINDING_TABLE_POOL_ALLOC << 16 | (3 - 2));
+   OUT_RELOC(brw->hw_bt_pool.bo, I915_GEM_DOMAIN_SAMPLER, 0, dw1);
+   OUT_RELOC(brw->hw_bt_pool.bo, I915_GEM_DOMAIN_SAMPLER, 0,
+ brw->hw_bt_pool.bo->size);
+   ADVANCE_BATCH();
+
+   /* From the BSpec, 3D Pipeline > Resource Streamer > Hardware Binding
+* Tables > Programming note
+
+* "When switching between HW and SW binding table generation, SW must
+* issue a state cache invalidate."
+*/
+   brw_emit_pipe_control_flush(brw, PIPE_CONTROL_STATE_CACHE_INVALIDATE);
+}
+
+void
+gen7_reset_rs_pool_offsets(struct brw_context *brw)
+{
+   brw->hw_bt_pool.next_offset = hw_bt_start_offset;
+}
+
+const struct brw_tracked_state gen7_hw_binding_tables = {
+   .dirty = {
+  .mesa = 0,
+  .brw = BRW_NEW_BATCH,
+   },
+   .emit = gen7_enable_hw_binding_tables
+};
+
 /** @} */
 
 /**
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index ea56859..4a572d1 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -961,6 +961,10 @@ intelDestroyContext(__DRIcontext * driContextPriv)

Re: [Mesa-dev] [PATCH v2 12/15] nv50/ir: optimize the use of std::tr1::unordered_set

2015-05-20 Thread Ilia Mirkin
On Wed, May 20, 2015 at 9:52 AM, Francisco Jerez  wrote:
> Ilia Mirkin  writes:
>
>> Francisco, any opinion on this patch (as the resident C++ expert)? It
>> seems a little odd. I'd just as soon skip this, and just use "using
>> std::tr1::unordered_set" or "using std::unordered_set" as necessary in
>> the next patch. But perhaps this is a common technique?
>>
> This seems really ugly to me.  I've given the patch a try and the single
> instantiation that this patch saves is some 2.7 kB of the binary, some
> 0.1% of the size of nouveau_compiler alone and 0.03% of the size of the
> DRI driver with my configuration.  IMHO the tiny saving in disk space
> hardly justifies the additional complexity and giving up the type-safe
> interface provided by the STL (except for the begin() and end() methods
> you have overridden with correct types, which is a tiny fraction of the
> unordered_set interface).

Thanks for confirming what I suspected -- this isn't a common way to
do things, and is not hugely beneficial (otherwise it'd be a common
way to do things, and/or the stl impl would do something clever to get
this sort of effect).

>
> If this is required for compatibility reasons with old Android systems I
> suggest you wrap it under a preprocessor conditional like:
>
> #if __cplusplus >= 201103L
> using std::unordered_set;
> #elif building-on-old-android-version-with-broken-stlport
> using my-funky-wrapper-for-std-unordered-set;
> #else
> using std::tr1::unordered_set;
> #endif

Chih-Wei, I think this is the right way to go as well. Could you
rework your nv50/ir patches into one that does it this way? Sounds
like the "#elif funky-wrapper" bit isn't actually needed anymore
either, as you're going with a C++11-only approach?

Cheers,

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


Re: [Mesa-dev] [RFC 00/10] Enable support for 2D ASTC HDR and LDR formats

2015-05-20 Thread Jason Ekstrand
On Tue, May 19, 2015 at 9:35 PM, Jason Ekstrand  wrote:
> On Tue, May 19, 2015 at 7:08 PM, Ilia Mirkin  wrote:
>> Hi Nanley,
>>
>> I was expecting to see some code dealing with the fact that the block
>> sizes are all different. Did I miss it, or is that still on the TODO
>> list?
>
> I think *most* of that code *should* already be there.  In theory,
> it's all keyed off of the block size provided by formats.csv.
> However, given some of the rendering errors we're currently seeing, it
> looks like it may need a little patching here and there. :-)

Matt pointed out this bug on IRC last night:

https://bugs.freedesktop.org/show_bug.cgi?id=76919

It looks like ASTC isn't the only place we have problems with textures
that aren't a multiple of the block size.  We were just seeing it
earlier with ASTC because it has such strange sizes.  Happy bug
hunting!
--Jason
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC 00/10] Enable support for 2D ASTC HDR and LDR formats

2015-05-20 Thread Neil Roberts
Jason Ekstrand  writes:

> I think *most* of that code *should* already be there.  In theory,
> it's all keyed off of the block size provided by formats.csv.
> However, given some of the rendering errors we're currently seeing, it
> looks like it may need a little patching here and there. :-)

intel_vertical_texture_alignment_unit is one place where we definitely
are hardcoding the block height to 4 (as currently even FXT1 has a block
*height* of 4). I guess the bit under if(is_format_compressed) would
need to be changed to be more like the one for the horizontal texture
alignment where it fetches the block size and multiplies it by 4 on
Gen9+.

It might be worth combining those two functions into one so that for the
compressed case it could query the block size just once and we could
avoid duplicating the comment.

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


[Mesa-dev] [PATCH 3/3] wglinfo: pass the options object to print_screen_info()

2015-05-20 Thread Brian Paul
To reduce the number of parameters.
---
 src/wgl/wglinfo.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/wgl/wglinfo.c b/src/wgl/wglinfo.c
index 42bf3a7..8693450 100644
--- a/src/wgl/wglinfo.c
+++ b/src/wgl/wglinfo.c
@@ -79,8 +79,7 @@ WndProc(HWND hWnd,
 
 
 static void
-print_screen_info(HDC _hdc, GLboolean limits, GLboolean singleLine,
-  GLboolean coreProfile, InfoMode mode)
+print_screen_info(HDC _hdc, const struct options *opts, GLboolean coreProfile)
 {
WNDCLASS wc;
HWND win;
@@ -253,9 +252,9 @@ print_screen_info(HDC _hdc, GLboolean limits, GLboolean 
singleLine,
*/
 
   if (!coreProfile) {
- if (wglExtensions && mode != Brief) {
+ if (wglExtensions && opts->mode != Brief) {
 printf("WGL extensions:\n");
-print_extension_list(wglExtensions, singleLine);
+print_extension_list(wglExtensions, opts->singleLine);
  }
  printf("OpenGL vendor string: %s\n", glVendor);
  printf("OpenGL renderer string: %s\n", glRenderer);
@@ -286,12 +285,12 @@ print_screen_info(HDC _hdc, GLboolean limits, GLboolean 
singleLine,
   }
 #endif
 
-  if (mode != Brief) {
+  if (opts->mode != Brief) {
  printf("%s extensions:\n", oglString);
- print_extension_list(glExtensions, singleLine);
+ print_extension_list(glExtensions, opts->singleLine);
   }
 
-  if (limits) {
+  if (opts->limits) {
  print_limits(glExtensions, oglString, version, &extfuncs);
   }
}
@@ -646,9 +645,9 @@ main(int argc, char *argv[])
   printf("%d\n", b);
}
else {
-  print_screen_info(hdc, opts.limits, opts.singleLine, GL_FALSE, 
opts.mode);
+  print_screen_info(hdc, &opts, GL_FALSE);
   printf("\n");
-  print_screen_info(hdc, opts.limits, opts.singleLine, GL_TRUE, opts.mode);
+  print_screen_info(hdc, &opts, GL_TRUE);
   printf("\n");
   if (opts.mode != Brief) {
  print_visual_info(hdc, opts.mode);
-- 
1.9.1

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


[Mesa-dev] [PATCH 1/3] glxinfo/wglinfo: add brief (-B) output mode

2015-05-20 Thread Brian Paul
Based on a patch by Bryan Quigley 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90438
---
 src/wgl/wglinfo.c  | 19 +++---
 src/xdemos/glinfo_common.c |  5 -
 src/xdemos/glinfo_common.h |  3 ++-
 src/xdemos/glxinfo.c   | 49 ++
 4 files changed, 46 insertions(+), 30 deletions(-)

diff --git a/src/wgl/wglinfo.c b/src/wgl/wglinfo.c
index b6285ec..42bf3a7 100644
--- a/src/wgl/wglinfo.c
+++ b/src/wgl/wglinfo.c
@@ -80,7 +80,7 @@ WndProc(HWND hWnd,
 
 static void
 print_screen_info(HDC _hdc, GLboolean limits, GLboolean singleLine,
-  GLboolean coreProfile)
+  GLboolean coreProfile, InfoMode mode)
 {
WNDCLASS wc;
HWND win;
@@ -253,7 +253,7 @@ print_screen_info(HDC _hdc, GLboolean limits, GLboolean 
singleLine,
*/
 
   if (!coreProfile) {
- if (wglExtensions) {
+ if (wglExtensions && mode != Brief) {
 printf("WGL extensions:\n");
 print_extension_list(wglExtensions, singleLine);
  }
@@ -286,8 +286,11 @@ print_screen_info(HDC _hdc, GLboolean limits, GLboolean 
singleLine,
   }
 #endif
 
-  printf("%s extensions:\n", oglString);
-  print_extension_list(glExtensions, singleLine);
+  if (mode != Brief) {
+ printf("%s extensions:\n", oglString);
+ print_extension_list(glExtensions, singleLine);
+  }
+
   if (limits) {
  print_limits(glExtensions, oglString, version, &extfuncs);
   }
@@ -643,11 +646,13 @@ main(int argc, char *argv[])
   printf("%d\n", b);
}
else {
-  print_screen_info(hdc, opts.limits, opts.singleLine, GL_FALSE);
+  print_screen_info(hdc, opts.limits, opts.singleLine, GL_FALSE, 
opts.mode);
   printf("\n");
-  print_screen_info(hdc, opts.limits, opts.singleLine, GL_TRUE);
+  print_screen_info(hdc, opts.limits, opts.singleLine, GL_TRUE, opts.mode);
   printf("\n");
-  print_visual_info(hdc, opts.mode);
+  if (opts.mode != Brief) {
+ print_visual_info(hdc, opts.mode);
+  }
}
 
return 0;
diff --git a/src/xdemos/glinfo_common.c b/src/xdemos/glinfo_common.c
index d3acc19..f4c359d 100644
--- a/src/xdemos/glinfo_common.c
+++ b/src/xdemos/glinfo_common.c
@@ -733,6 +733,7 @@ usage(void)
printf("\t-display : Print GLX visuals on specified server.\n");
printf("\t-i: Force an indirect rendering context.\n");
 #endif
+   printf("\t-q: quiet, print only the basics.\n");
printf("\t-v: Print visuals info in verbose form.\n");
printf("\t-t: Print verbose table.\n");
printf("\t-h: This information.\n");
@@ -741,7 +742,6 @@ usage(void)
printf("\t-s: Print a single extension per line.\n");
 }
 
-
 void
 parse_args(int argc, char *argv[], struct options *options)
 {
@@ -771,6 +771,9 @@ parse_args(int argc, char *argv[], struct options *options)
   else if (strcmp(argv[i], "-v") == 0) {
  options->mode = Verbose;
   }
+  else if (strcmp(argv[i], "-B") == 0) {
+ options->mode = Brief;
+  }
   else if (strcmp(argv[i], "-b") == 0) {
  options->findBest = GL_TRUE;
   }
diff --git a/src/xdemos/glinfo_common.h b/src/xdemos/glinfo_common.h
index 0830c7f..ad867ee 100644
--- a/src/xdemos/glinfo_common.h
+++ b/src/xdemos/glinfo_common.h
@@ -67,7 +67,8 @@ typedef enum
 {
Normal,
Wide,
-   Verbose
+   Verbose,
+   Brief
 } InfoMode;
 
 
diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c
index c3e4ca3..b25186b 100644
--- a/src/xdemos/glxinfo.c
+++ b/src/xdemos/glxinfo.c
@@ -26,6 +26,7 @@
  *  -t print wide table
  *  -v print verbose information
  *  -display DisplayName   specify the X display to interogate
+ *  -B brief, print only the basics
  *  -b only print ID of "best" visual on screen 0
  *  -i use indirect rendering connection only
  *  -l print interesting OpenGL limits (added 5 Sep 2002)
@@ -392,7 +393,7 @@ query_renderer(void)
 static Bool
 print_screen_info(Display *dpy, int scrnum, Bool allowDirect,
   Bool coreProfile, Bool es2Profile, Bool limits,
-  Bool singleLine, Bool coreWorked)
+  Bool singleLine, Bool coreWorked, InfoMode mode)
 {
Window win;
XSetWindowAttributes attr;
@@ -529,17 +530,19 @@ print_screen_info(Display *dpy, int scrnum, Bool 
allowDirect,
   "LIBGL_DEBUG=verbose)\n");
 }
  }
- printf("server glx vendor string: %s\n", serverVendor);
- printf("server glx version string: %s\n", serverVersion);
- printf("server glx extensions:\n");
- print_extension_list(serverExtensions, singleLine);
- printf("client glx vendor string: %s\n", clientVendor);
- printf("client glx version string: %s\n", clientVersion);
- printf("client glx extensions:\n");
- print_extension_

[Mesa-dev] [PATCH 2/3] glxinfo: pass the options object to print_screen_info()

2015-05-20 Thread Brian Paul
To reduce the number of parameters.
---
 src/xdemos/glxinfo.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c
index b25186b..0f28647 100644
--- a/src/xdemos/glxinfo.c
+++ b/src/xdemos/glxinfo.c
@@ -391,9 +391,10 @@ query_renderer(void)
 
 
 static Bool
-print_screen_info(Display *dpy, int scrnum, Bool allowDirect,
+print_screen_info(Display *dpy, int scrnum,
+  const struct options *opts,
   Bool coreProfile, Bool es2Profile, Bool limits,
-  Bool singleLine, Bool coreWorked, InfoMode mode)
+  Bool coreWorked)
 {
Window win;
XSetWindowAttributes attr;
@@ -414,8 +415,9 @@ print_screen_info(Display *dpy, int scrnum, Bool 
allowDirect,
fbconfigs = choose_fb_config(dpy, scrnum);
if (fbconfigs) {
   ctx = create_context_with_config(dpy, fbconfigs[0],
-   coreProfile, es2Profile, allowDirect);
-  if (!ctx && allowDirect && !coreProfile) {
+   coreProfile, es2Profile,
+   opts->allowDirect);
+  if (!ctx && opts->allowDirect && !coreProfile) {
  /* try indirect */
  ctx = create_context_with_config(dpy, fbconfigs[0],
   coreProfile, es2Profile, False);
@@ -427,7 +429,7 @@ print_screen_info(Display *dpy, int scrnum, Bool 
allowDirect,
else if (!coreProfile && !es2Profile) {
   visinfo = choose_xvisinfo(dpy, scrnum);
   if (visinfo)
-ctx = glXCreateContext(dpy, visinfo, NULL, allowDirect);
+ctx = glXCreateContext(dpy, visinfo, NULL, opts->allowDirect);
} else
   visinfo = NULL;
 
@@ -519,7 +521,7 @@ print_screen_info(Display *dpy, int scrnum, Bool 
allowDirect,
 printf("Yes\n");
  }
  else {
-if (!allowDirect) {
+if (!opts->allowDirect) {
printf("No (-i specified)\n");
 }
 else if (getenv("LIBGL_ALWAYS_INDIRECT")) {
@@ -530,18 +532,18 @@ print_screen_info(Display *dpy, int scrnum, Bool 
allowDirect,
   "LIBGL_DEBUG=verbose)\n");
 }
  }
- if (mode != Brief) {
+ if (opts->mode != Brief) {
 printf("server glx vendor string: %s\n", serverVendor);
 printf("server glx version string: %s\n", serverVersion);
 printf("server glx extensions:\n");
-print_extension_list(serverExtensions, singleLine);
+print_extension_list(serverExtensions, opts->singleLine);
 printf("client glx vendor string: %s\n", clientVendor);
 printf("client glx version string: %s\n", clientVersion);
 printf("client glx extensions:\n");
-print_extension_list(clientExtensions, singleLine);
+print_extension_list(clientExtensions, opts->singleLine);
 printf("GLX version: %u.%u\n", glxVersionMajor, glxVersionMinor);
 printf("GLX extensions:\n");
-print_extension_list(glxExtensions, singleLine);
+print_extension_list(glxExtensions, opts->singleLine);
  }
  if (strstr(glxExtensions, "GLX_MESA_query_renderer"))
query_renderer();
@@ -581,9 +583,9 @@ print_screen_info(Display *dpy, int scrnum, Bool 
allowDirect,
 
   CheckError(__LINE__);
 
-  if (mode != Brief) {
+  if (opts->mode != Brief) {
  printf("%s extensions:\n", oglstring);
- print_extension_list(glExtensions, singleLine);
+ print_extension_list(glExtensions, opts->singleLine);
   }
 
   if (limits) {
@@ -1253,13 +1255,11 @@ main(int argc, char *argv[])
   print_display_info(dpy);
   for (scrnum = 0; scrnum < numScreens; scrnum++) {
  mesa_hack(dpy, scrnum);
- coreWorked = print_screen_info(dpy, scrnum, opts.allowDirect,
-True, False, opts.limits,
-opts.singleLine, False, opts.mode);
- print_screen_info(dpy, scrnum, opts.allowDirect, False, False,
-   opts.limits, opts.singleLine, coreWorked, 
opts.mode);
- print_screen_info(dpy, scrnum, opts.allowDirect, False, True, False,
-   opts.singleLine, True, opts.mode);
+ coreWorked = print_screen_info(dpy, scrnum, &opts,
+True, False, opts.limits, False);
+ print_screen_info(dpy, scrnum, &opts, False, False,
+   opts.limits, coreWorked);
+ print_screen_info(dpy, scrnum, &opts, False, True, False, True);
 
  printf("\n");
 
-- 
1.9.1

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


Re: [Mesa-dev] [RFC 00/10] Enable support for 2D ASTC HDR and LDR formats

2015-05-20 Thread Nanley Chery
On Tue, May 19, 2015 at 9:35 PM, Jason Ekstrand 
wrote:

> On Tue, May 19, 2015 at 7:08 PM, Ilia Mirkin  wrote:
> > Hi Nanley,
> >
> > I was expecting to see some code dealing with the fact that the block
> > sizes are all different. Did I miss it, or is that still on the TODO
> > list?
>
> I think *most* of that code *should* already be there.  In theory,
> it's all keyed off of the block size provided by formats.csv.
> However, given some of the rendering errors we're currently seeing, it
> looks like it may need a little patching here and there. :-)
> --Jason
>
> > Cheers,
> >
> >   -ilia
> >
> > P.S. Congrats on your first public patch submission to mesa-dev :)
> >
>
Thanks for the welcome!
- Nanley


> > On Tue, May 19, 2015 at 8:48 PM, Nanley Chery 
> wrote:
> >> From: Nanley Chery 
> >>
> >> This patch series adds support for the
> KHR_texture_compression_astc_{ldr,hdr}
> >> extensions. The last two commits enable support for Skylake systems.
> >>
> >> Some rendering issues were encountered during testing, so there is some
> more
> >> work to be done on this feature. The Piglit tests for this extension
> can be
> >> found here: cgit.freedesktop.org/~nchery/piglit
> >>
> >> Nanley Chery (10):
> >>   mesa/formats: define the 2D ASTC formats
> >>   glapi: add support for KHR_texture_compression_astc_ldr
> >>   mesa: disable online compression for ASTC formats
> >>   mesa: add ASTC extensions to the extensions table
> >>   mesa/glformats: recognize ASTC formats as compressed
> >>   mesa/texcompress: enable translation between MESA and GL ASTC formats
> >>   mesa/teximage: return the base internal format of the ASTC formats
> >>   mesa/formats: store whether or not a format is sRGB in gl_format_info
> >>   i965/surface_formats: add support for 2D ASTC surface formats
> >>   i965: enable ASTC support for Skylake
> >>
> >>  .../glapi/gen/KHR_texture_compression_astc.xml |  40 ++
> >>  src/mapi/glapi/gen/Makefile.am |   1 +
> >>  src/mapi/glapi/gen/gl_API.xml  |   2 +-
> >>  src/mesa/drivers/dri/i965/brw_defines.h|  36 +
> >>  src/mesa/drivers/dri/i965/brw_surface_formats.c|  67 -
> >>  src/mesa/drivers/dri/i965/intel_extensions.c   |   6 +
> >>  src/mesa/main/extensions.c |   3 +
> >>  src/mesa/main/format_info.py   |   5 +
> >>  src/mesa/main/formats.c| 159
> +
> >>  src/mesa/main/formats.csv  |  31 
> >>  src/mesa/main/formats.h|  30 
> >>  src/mesa/main/glformats.c  |  29 
> >>  src/mesa/main/mtypes.h |   3 +
> >>  src/mesa/main/texcompress.c| 136
> ++
> >>  src/mesa/main/teximage.c   |  64 +
> >>  src/mesa/swrast/s_texfetch.c   |  32 -
> >>  16 files changed, 616 insertions(+), 28 deletions(-)
> >>  create mode 100644 src/mapi/glapi/gen/KHR_texture_compression_astc.xml
> >>
> >> --
> >> 2.4.1
> >>
> >> ___
> >> mesa-dev mailing list
> >> mesa-dev@lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC 02/10] glapi: add support for KHR_texture_compression_astc_ldr

2015-05-20 Thread Nanley Chery
Hi Ilia,

Thanks for finding these errors. I'll have fixes in v2.

- Nanley

On Tue, May 19, 2015 at 7:07 PM, Ilia Mirkin  wrote:

> On Tue, May 19, 2015 at 8:48 PM, Nanley Chery 
> wrote:
> > From: Nanley Chery 
> >
> > Signed-off-by: Nanley Chery 
> > ---
> >  .../glapi/gen/KHR_texture_compression_astc.xml | 40
> ++
> >  src/mapi/glapi/gen/Makefile.am |  1 +
> >  src/mapi/glapi/gen/gl_API.xml  |  2 +-
> >  3 files changed, 42 insertions(+), 1 deletion(-)
> >  create mode 100644 src/mapi/glapi/gen/KHR_texture_compression_astc.xml
> >
> > diff --git a/src/mapi/glapi/gen/KHR_texture_compression_astc.xml
> b/src/mapi/glapi/gen/KHR_texture_compression_astc.xml
> > new file mode 100644
> > index 000..68dbf19
> > --- /dev/null
> > +++ b/src/mapi/glapi/gen/KHR_texture_compression_astc.xml
> > @@ -0,0 +1,40 @@
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
>
> I think we use value= everywhere, not value =. Minor point though.
>
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > + "0x93D0"/>
>
> The spec I'm looking at calls it "COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR".
>
> > + "0x93D1"/>
> > + "0x93D2"/>
> > + "0x93D3"/>
> > + "0x93D4"/>
> > + "0x93D5"/>
> > + "0x93D6"/>
> > + "0x93D7"/>
> > + "0x93D8"/>
> > + "0x93D9"/>
> > + "0x93DA"/>
> > + "0x93DB"/>
> > + "0x93DC"/>
> > + "0x93DD"/>
> > +
> > +
> > +
> > +
> > diff --git a/src/mapi/glapi/gen/Makefile.am
> b/src/mapi/glapi/gen/Makefile.am
> > index adebd5c..e0c09ec 100644
> > --- a/src/mapi/glapi/gen/Makefile.am
> > +++ b/src/mapi/glapi/gen/Makefile.am
> > @@ -185,6 +185,7 @@ API_XML = \
> > INTEL_performance_query.xml \
> > KHR_debug.xml \
> > KHR_context_flush_control.xml \
> > +   KHR_texture_compression_astc.xml \
> > NV_conditional_render.xml \
> > NV_primitive_restart.xml \
> > NV_texture_barrier.xml \
> > diff --git a/src/mapi/glapi/gen/gl_API.xml
> b/src/mapi/glapi/gen/gl_API.xml
> > index 3090b9f..38309a4 100644
> > --- a/src/mapi/glapi/gen/gl_API.xml
> > +++ b/src/mapi/glapi/gen/gl_API.xml
> > @@ -8162,7 +8162,7 @@
> >
> >  http://www.w3.org/2001/XInclude"/>
> >
> > -
> > +http://www.w3.org/2001/XInclude"/>
> >
> >  http://www.w3.org/2001/XInclude"/>
> >
> > --
> > 2.4.1
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] wglinfo: pass the options object to print_screen_info()

2015-05-20 Thread Matt Turner
I didn't review them very closely, but I like the idea!

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


Re: [Mesa-dev] [PATCH 1/3] glxinfo/wglinfo: add brief (-B) output mode

2015-05-20 Thread Ilia Mirkin
On Wed, May 20, 2015 at 1:14 PM, Brian Paul  wrote:
> Based on a patch by Bryan Quigley 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90438
> ---
>  src/wgl/wglinfo.c  | 19 +++---
>  src/xdemos/glinfo_common.c |  5 -
>  src/xdemos/glinfo_common.h |  3 ++-
>  src/xdemos/glxinfo.c   | 49 
> ++
>  4 files changed, 46 insertions(+), 30 deletions(-)
>
> diff --git a/src/xdemos/glinfo_common.c b/src/xdemos/glinfo_common.c
> index d3acc19..f4c359d 100644
> --- a/src/xdemos/glinfo_common.c
> +++ b/src/xdemos/glinfo_common.c
> @@ -733,6 +733,7 @@ usage(void)
> printf("\t-display : Print GLX visuals on specified server.\n");
> printf("\t-i: Force an indirect rendering context.\n");
>  #endif
> +   printf("\t-q: quiet, print only the basics.\n");

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


Re: [Mesa-dev] [PATCH 1/3] glxinfo/wglinfo: add brief (-B) output mode

2015-05-20 Thread Brian Paul

On 05/20/2015 10:55 AM, Ilia Mirkin wrote:

On Wed, May 20, 2015 at 1:14 PM, Brian Paul  wrote:

Based on a patch by Bryan Quigley 
Bugzilla: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D90438&d=AwIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8&m=rwxctcI3yZ1dFP3jUPgmc7e-fC5uEYZhzLJPSDs4v-0&s=o2CWyV1H_9yy9nYD45MA4oKmMlVlQ2cdl0ljuf9zWws&e=
---
  src/wgl/wglinfo.c  | 19 +++---
  src/xdemos/glinfo_common.c |  5 -
  src/xdemos/glinfo_common.h |  3 ++-
  src/xdemos/glxinfo.c   | 49 ++
  4 files changed, 46 insertions(+), 30 deletions(-)

diff --git a/src/xdemos/glinfo_common.c b/src/xdemos/glinfo_common.c
index d3acc19..f4c359d 100644
--- a/src/xdemos/glinfo_common.c
+++ b/src/xdemos/glinfo_common.c
@@ -733,6 +733,7 @@ usage(void)
 printf("\t-display : Print GLX visuals on specified server.\n");
 printf("\t-i: Force an indirect rendering context.\n");
  #endif
+   printf("\t-q: quiet, print only the basics.\n");


oops?


Thanks.  Will fix before pushing.

-Brian


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


[Mesa-dev] [PATCH 0/5] i965/fs: Remove the old visitor code

2015-05-20 Thread Jason Ekstrand
Now that we're using NIR by default and everything seems stable there, we
have about 3000 lines of extra code lying around that we don't need.  We
might as well delete it. :-)

This series together with one of the patches I sent yesterday can be found
in the review/fs-nir-only branch on my freedesktop:

http://cgit.freedesktop.org/~jekstrand/mesa/log/?h=review/fs-nir-only

Jason Ekstrand (5):
  i965: Rename backend_visitor to backend_shader
  i965: Make fs/vec4_visitor inherit from ir_visitor directly
  i965: Make NIR non-optional for scalar shaders
  i965: Remove the old fragment program code
  i965/fs: Remove the ir_visitor code

 src/mesa/drivers/dri/i965/Makefile.sources |1 -
 src/mesa/drivers/dri/i965/brw_cfg.cpp  |   10 +-
 src/mesa/drivers/dri/i965/brw_cfg.h|4 +-
 src/mesa/drivers/dri/i965/brw_context.c|7 +-
 .../drivers/dri/i965/brw_dead_control_flow.cpp |6 +-
 src/mesa/drivers/dri/i965/brw_dead_control_flow.h  |2 +-
 src/mesa/drivers/dri/i965/brw_fs.cpp   |  128 +-
 src/mesa/drivers/dri/i965/brw_fs.h |   76 +-
 src/mesa/drivers/dri/i965/brw_fs_fp.cpp|  742 ---
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   | 2141 +---
 .../drivers/dri/i965/brw_schedule_instructions.cpp |   18 +-
 src/mesa/drivers/dri/i965/brw_shader.cpp   |   20 +-
 src/mesa/drivers/dri/i965/brw_shader.h |   12 +-
 src/mesa/drivers/dri/i965/brw_vec4.cpp |4 +-
 src/mesa/drivers/dri/i965/brw_vec4.h   |2 +-
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |2 +-
 16 files changed, 79 insertions(+), 3096 deletions(-)
 delete mode 100644 src/mesa/drivers/dri/i965/brw_fs_fp.cpp

-- 
2.4.1

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


[Mesa-dev] [PATCH 2/5] i965: Make fs/vec4_visitor inherit from ir_visitor directly

2015-05-20 Thread Jason Ekstrand
This is using multiple inheritance in C++.  However, ir_visitor is really
just an interface with no data so it shouldn't be so bad.
---
 src/mesa/drivers/dri/i965/brw_fs.h | 2 +-
 src/mesa/drivers/dri/i965/brw_shader.h | 2 +-
 src/mesa/drivers/dri/i965/brw_vec4.h   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index f63b149..6f16c31 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -66,7 +66,7 @@ namespace brw {
  *
  * Translates either GLSL IR or Mesa IR (for ARB_fragment_program) into FS IR.
  */
-class fs_visitor : public backend_shader
+class fs_visitor : public backend_shader, public ir_visitor
 {
 public:
const fs_reg reg_null_f;
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h 
b/src/mesa/drivers/dri/i965/brw_shader.h
index ac9acfc..da01d2f 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -211,7 +211,7 @@ enum instruction_scheduler_mode {
SCHEDULE_POST,
 };
 
-class backend_shader : public ir_visitor {
+class backend_shader {
 protected:
 
backend_shader(struct brw_context *brw,
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index f781343..06a16a4 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -73,7 +73,7 @@ class vec4_live_variables;
  * Translates either GLSL IR or Mesa IR (for ARB_vertex_program and
  * fixed-function) into VS IR.
  */
-class vec4_visitor : public backend_shader
+class vec4_visitor : public backend_shader, public ir_visitor
 {
 public:
vec4_visitor(struct brw_context *brw,
-- 
2.4.1

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


[Mesa-dev] [PATCH 1/5] i965: Rename backend_visitor to backend_shader

2015-05-20 Thread Jason Ekstrand
The backend_shader class really is a representation of a shader.  The fact
that it inherits from ir_visitor is somewhat immaterial.
---
 src/mesa/drivers/dri/i965/brw_cfg.cpp| 10 +-
 src/mesa/drivers/dri/i965/brw_cfg.h  |  4 ++--
 src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp  |  6 +++---
 src/mesa/drivers/dri/i965/brw_dead_control_flow.h|  2 +-
 src/mesa/drivers/dri/i965/brw_fs.cpp |  4 ++--
 src/mesa/drivers/dri/i965/brw_fs.h   |  2 +-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |  2 +-
 .../drivers/dri/i965/brw_schedule_instructions.cpp   | 18 +-
 src/mesa/drivers/dri/i965/brw_shader.cpp | 20 ++--
 src/mesa/drivers/dri/i965/brw_shader.h   | 12 ++--
 src/mesa/drivers/dri/i965/brw_vec4.cpp   |  4 ++--
 src/mesa/drivers/dri/i965/brw_vec4.h |  2 +-
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp   |  2 +-
 13 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp 
b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index 7e7770e..39c419b 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -141,12 +141,12 @@ bblock_t::combine_with(bblock_t *that)
 }
 
 void
-bblock_t::dump(backend_visitor *v) const
+bblock_t::dump(backend_shader *s) const
 {
int ip = this->start_ip;
foreach_inst_in_block(backend_instruction, inst, this) {
   fprintf(stderr, "%5d: ", ip);
-  v->dump_instruction(inst);
+  s->dump_instruction(inst);
   ip++;
}
 }
@@ -411,7 +411,7 @@ cfg_t::make_block_array()
 }
 
 void
-cfg_t::dump(backend_visitor *v)
+cfg_t::dump(backend_shader *s)
 {
if (idom_dirty)
   calculate_idom();
@@ -423,8 +423,8 @@ cfg_t::dump(backend_visitor *v)
  link->block->num);
   }
   fprintf(stderr, "\n");
-  if (v != NULL)
- block->dump(v);
+  if (s != NULL)
+ block->dump(s);
   fprintf(stderr, "END B%d", block->num);
   foreach_list_typed(bblock_link, link, link, &block->children) {
  fprintf(stderr, " ->B%d",
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h 
b/src/mesa/drivers/dri/i965/brw_cfg.h
index 56d7d07..a094917 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.h
+++ b/src/mesa/drivers/dri/i965/brw_cfg.h
@@ -60,7 +60,7 @@ struct bblock_t {
bool is_successor_of(const bblock_t *block) const;
bool can_combine_with(const bblock_t *that) const;
void combine_with(bblock_t *that);
-   void dump(backend_visitor *v) const;
+   void dump(backend_shader *s) const;
 
backend_instruction *start();
const backend_instruction *start() const;
@@ -273,7 +273,7 @@ struct cfg_t {
void calculate_idom();
static bblock_t *intersect(bblock_t *b1, bblock_t *b2);
 
-   void dump(backend_visitor *v);
+   void dump(backend_shader *s);
void dump_cfg();
void dump_domtree();
 #endif
diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp 
b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
index 03f838d..61f2581 100644
--- a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
+++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
@@ -36,11 +36,11 @@
  *   - if/else/endif
  */
 bool
-dead_control_flow_eliminate(backend_visitor *v)
+dead_control_flow_eliminate(backend_shader *s)
 {
bool progress = false;
 
-   foreach_block_safe (block, v->cfg) {
+   foreach_block_safe (block, s->cfg) {
   bblock_t *if_block = NULL, *else_block = NULL, *endif_block = block;
   bool found = false;
 
@@ -115,7 +115,7 @@ dead_control_flow_eliminate(backend_visitor *v)
}
 
if (progress)
-  v->invalidate_live_intervals();
+  s->invalidate_live_intervals();
 
return progress;
 }
diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.h 
b/src/mesa/drivers/dri/i965/brw_dead_control_flow.h
index 57a4dab..83fd9b1 100644
--- a/src/mesa/drivers/dri/i965/brw_dead_control_flow.h
+++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.h
@@ -23,4 +23,4 @@
 
 #include "brw_shader.h"
 
-bool dead_control_flow_eliminate(backend_visitor *v);
+bool dead_control_flow_eliminate(backend_shader *s);
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 9b3186b..1fc09cc 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -4089,7 +4089,7 @@ fs_visitor::optimize()
  snprintf(filename, 64, "%s%d-%04d-%02d-%02d-" #pass,  \
   stage_abbrev, dispatch_width, shader_prog ? 
shader_prog->Name : 0, iteration, pass_num); \
 \
- backend_visitor::dump_instructions(filename);  \
+ backend_shader::dump_instructions(filename);   \
   } \

[Mesa-dev] [PATCH 5/5] i965/fs: Remove the ir_visitor code

2015-05-20 Thread Jason Ekstrand
Now that everything is running through NIR, this is all dead.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |   99 --
 src/mesa/drivers/dri/i965/brw_fs.h   |   50 +-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 2139 +-
 3 files changed, 31 insertions(+), 2257 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 9bacdfa..a69800b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1129,117 +1129,18 @@ fs_reg::fs_reg(enum register_file file, int reg, enum 
brw_reg_type type,
this->width = width;
 }
 
-fs_reg *
-fs_visitor::variable_storage(ir_variable *var)
-{
-   return (fs_reg *)hash_table_find(this->variable_ht, var);
-}
-
-void
-import_uniforms_callback(const void *key,
-void *data,
-void *closure)
-{
-   struct hash_table *dst_ht = (struct hash_table *)closure;
-   const fs_reg *reg = (const fs_reg *)data;
-
-   if (reg->file != UNIFORM)
-  return;
-
-   hash_table_insert(dst_ht, data, key);
-}
-
 /* For SIMD16, we need to follow from the uniform setup of SIMD8 dispatch.
  * This brings in those uniform definitions
  */
 void
 fs_visitor::import_uniforms(fs_visitor *v)
 {
-   hash_table_call_foreach(v->variable_ht,
-  import_uniforms_callback,
-  variable_ht);
this->push_constant_loc = v->push_constant_loc;
this->pull_constant_loc = v->pull_constant_loc;
this->uniforms = v->uniforms;
this->param_size = v->param_size;
 }
 
-/* Our support for uniforms is piggy-backed on the struct
- * gl_fragment_program, because that's where the values actually
- * get stored, rather than in some global gl_shader_program uniform
- * store.
- */
-void
-fs_visitor::setup_uniform_values(ir_variable *ir)
-{
-   int namelen = strlen(ir->name);
-
-   /* The data for our (non-builtin) uniforms is stored in a series of
-* gl_uniform_driver_storage structs for each subcomponent that
-* glGetUniformLocation() could name.  We know it's been set up in the same
-* order we'd walk the type, so walk the list of storage and find anything
-* with our name, or the prefix of a component that starts with our name.
-*/
-   unsigned params_before = uniforms;
-   for (unsigned u = 0; u < shader_prog->NumUserUniformStorage; u++) {
-  struct gl_uniform_storage *storage = &shader_prog->UniformStorage[u];
-
-  if (strncmp(ir->name, storage->name, namelen) != 0 ||
-  (storage->name[namelen] != 0 &&
-   storage->name[namelen] != '.' &&
-   storage->name[namelen] != '[')) {
- continue;
-  }
-
-  unsigned slots = storage->type->component_slots();
-  if (storage->array_elements)
- slots *= storage->array_elements;
-
-  for (unsigned i = 0; i < slots; i++) {
- stage_prog_data->param[uniforms++] = &storage->storage[i];
-  }
-   }
-
-   /* Make sure we actually initialized the right amount of stuff here. */
-   assert(params_before + ir->type->component_slots() == uniforms);
-   (void)params_before;
-}
-
-
-/* Our support for builtin uniforms is even scarier than non-builtin.
- * It sits on top of the PROG_STATE_VAR parameters that are
- * automatically updated from GL context state.
- */
-void
-fs_visitor::setup_builtin_uniform_values(ir_variable *ir)
-{
-   const ir_state_slot *const slots = ir->get_state_slots();
-   assert(slots != NULL);
-
-   for (unsigned int i = 0; i < ir->get_num_state_slots(); i++) {
-  /* This state reference has already been setup by ir_to_mesa, but we'll
-   * get the same index back here.
-   */
-  int index = _mesa_add_state_reference(this->prog->Parameters,
-   (gl_state_index *)slots[i].tokens);
-
-  /* Add each of the unique swizzles of the element as a parameter.
-   * This'll end up matching the expected layout of the
-   * array/matrix/structure we're trying to fill in.
-   */
-  int last_swiz = -1;
-  for (unsigned int j = 0; j < 4; j++) {
-int swiz = GET_SWZ(slots[i].swizzle, j);
-if (swiz == last_swiz)
-   break;
-last_swiz = swiz;
-
- stage_prog_data->param[uniforms++] =
-&prog->Parameters->ParameterValues[index][swiz];
-  }
-   }
-}
-
 fs_reg *
 fs_visitor::emit_fragcoord_interpolation(bool pixel_center_integer,
  bool origin_upper_left)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index 63414eb..3bdf0a2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -66,7 +66,7 @@ namespace brw {
  *
  * Translates either GLSL IR or Mesa IR (for ARB_fragment_program) into FS IR.
  */
-class fs_visitor : public backend_shader, public ir_visitor
+class fs_visitor : public backend_shader
 {
 public:
const fs_reg reg_null

Re: [Mesa-dev] [RFC 10/10] i965: enable ASTC support for Skylake

2015-05-20 Thread Nanley Chery
On Tue, May 19, 2015 at 7:22 PM, Ilia Mirkin  wrote:
>
> On Tue, May 19, 2015 at 10:16 PM, Matt Turner  wrote:
> > On Tue, May 19, 2015 at 5:48 PM, Nanley Chery  wrote:
> >> From: Nanley Chery 
> >>
> >> Signed-off-by: Nanley Chery 
> >> ---
> >>  src/mesa/drivers/dri/i965/intel_extensions.c | 6 ++
> >>  1 file changed, 6 insertions(+)
> >>
> >> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c 
> >> b/src/mesa/drivers/dri/i965/intel_extensions.c
> >> index 18b69a0..91ff6e4 100644
> >> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
> >> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
> >> @@ -354,6 +354,12 @@ intelInitExtensions(struct gl_context *ctx)
> >>ctx->Extensions.ARB_stencil_texturing = true;
> >> }
> >>
> >> +   if (brw->gen >= 9) {
> >> +  ctx->Extensions.KHR_texture_compression_astc_ldr = true;
> >> +  ctx->Extensions.KHR_texture_compression_astc_hdr = true;
> >> +  ctx->Extensions.OES_texture_compression_astc= true;
> >
> > Missing space before =
>
> Also missing 3d astc format support (for the OES ext).


Good catch. I should modify my patches to only deal with the KHR
extensions only, since those are the only ones I'm enabling at this
time.

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


[Mesa-dev] [PATCH 3/5] i965: Make NIR non-optional for scalar shaders

2015-05-20 Thread Jason Ekstrand
---
 src/mesa/drivers/dri/i965/brw_context.c |  7 ++-
 src/mesa/drivers/dri/i965/brw_fs.cpp| 25 +++--
 2 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index ea56859..274a237 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -590,13 +590,10 @@ brw_initialize_context_constants(struct brw_context *brw)
   ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitNoIndirectTemp 
= true;
   ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = 
false;
 
-  if (brw_env_var_as_boolean("INTEL_USE_NIR", true))
- ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].NirOptions = 
&nir_options;
+  ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].NirOptions = 
&nir_options;
}
 
-   if (brw_env_var_as_boolean("INTEL_USE_NIR", true))
-  ctx->Const.ShaderCompilerOptions[MESA_SHADER_FRAGMENT].NirOptions = 
&nir_options;
-
+   ctx->Const.ShaderCompilerOptions[MESA_SHADER_FRAGMENT].NirOptions = 
&nir_options;
ctx->Const.ShaderCompilerOptions[MESA_SHADER_COMPUTE].NirOptions = 
&nir_options;
 
/* ARB_viewport_array */
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 1fc09cc..9bacdfa 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -4244,16 +4244,7 @@ fs_visitor::run_vs()
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
   emit_shader_time_begin();
 
-   if (brw->ctx.Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].NirOptions) {
-  emit_nir_code();
-   } else {
-  foreach_in_list(ir_instruction, ir, shader->base.ir) {
- base_ir = ir;
- this->result = reg_undef;
- ir->accept(this);
-  }
-  base_ir = NULL;
-   }
+   emit_nir_code();
 
if (failed)
   return false;
@@ -4320,18 +4311,8 @@ fs_visitor::run_fs()
   /* Generate FS IR for main().  (the visitor only descends into
* functions called "main").
*/
-  if 
(brw->ctx.Const.ShaderCompilerOptions[MESA_SHADER_FRAGMENT].NirOptions) {
- emit_nir_code();
-  } else if (shader) {
- foreach_in_list(ir_instruction, ir, shader->base.ir) {
-base_ir = ir;
-this->result = reg_undef;
-ir->accept(this);
- }
-  } else {
- emit_fragment_program_code();
-  }
-  base_ir = NULL;
+  emit_nir_code();
+
   if (failed)
 return false;
 
-- 
2.4.1

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


[Mesa-dev] [PATCH 4/5] i965: Remove the old fragment program code

2015-05-20 Thread Jason Ekstrand
Now that everything is running through NIR, this is all dead.
---
 src/mesa/drivers/dri/i965/Makefile.sources |   1 -
 src/mesa/drivers/dri/i965/brw_fs.h |  26 -
 src/mesa/drivers/dri/i965/brw_fs_fp.cpp| 742 -
 3 files changed, 769 deletions(-)
 delete mode 100644 src/mesa/drivers/dri/i965/brw_fs_fp.cpp

diff --git a/src/mesa/drivers/dri/i965/Makefile.sources 
b/src/mesa/drivers/dri/i965/Makefile.sources
index ad73e6b..3f852cd 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -49,7 +49,6 @@ i965_FILES = \
brw_fs.cpp \
brw_fs_cse.cpp \
brw_fs_dead_code_eliminate.cpp \
-   brw_fs_fp.cpp \
brw_fs_generator.cpp \
brw_fs.h \
brw_fs_live_variables.cpp \
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index 6f16c31..63414eb 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -332,29 +332,6 @@ public:
void emit_spill(bblock_t *block, fs_inst *inst, fs_reg reg,
uint32_t spill_offset, int count);
 
-   void emit_fragment_program_code();
-   void setup_fp_regs();
-   fs_reg get_fp_src_reg(const prog_src_register *src);
-   fs_reg get_fp_dst_reg(const prog_dst_register *dst);
-   void emit_fp_alu1(enum opcode opcode,
- const struct prog_instruction *fpi,
- fs_reg dst, fs_reg src);
-   void emit_fp_alu2(enum opcode opcode,
- const struct prog_instruction *fpi,
- fs_reg dst, fs_reg src0, fs_reg src1);
-   void emit_fp_scalar_write(const struct prog_instruction *fpi,
- fs_reg dst, fs_reg src);
-   void emit_fp_scalar_math(enum opcode opcode,
-const struct prog_instruction *fpi,
-fs_reg dst, fs_reg src);
-
-   void emit_fp_minmax(const struct prog_instruction *fpi,
-   fs_reg dst, fs_reg src0, fs_reg src1);
-
-   void emit_fp_sop(enum brw_conditional_mod conditional_mod,
-const struct prog_instruction *fpi,
-fs_reg dst, fs_reg src0, fs_reg src1, fs_reg one);
-
void emit_nir_code();
void nir_setup_inputs(nir_shader *shader);
void nir_setup_outputs(nir_shader *shader);
@@ -472,9 +449,6 @@ public:
/** Either BRW_MAX_GRF or GEN7_MRF_HACK_START */
unsigned max_grf;
 
-   fs_reg *fp_temp_regs;
-   fs_reg *fp_input_regs;
-
fs_reg *nir_locals;
fs_reg *nir_globals;
fs_reg nir_inputs;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
deleted file mode 100644
index 6518ff6..000
--- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
+++ /dev/null
@@ -1,742 +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.
- */
-
-/** @file brw_fs_fp.cpp
- *
- * Implementation of the compiler for GL_ARB_fragment_program shaders on top
- * of the GLSL compiler backend.
- */
-
-#include "brw_context.h"
-#include "brw_fs.h"
-
-void
-fs_visitor::emit_fp_alu1(enum opcode opcode,
- const struct prog_instruction *fpi,
- fs_reg dst, fs_reg src)
-{
-   for (int i = 0; i < 4; i++) {
-  if (fpi->DstReg.WriteMask & (1 << i))
- emit(opcode, offset(dst, i), offset(src, i));
-   }
-}
-
-void
-fs_visitor::emit_fp_alu2(enum opcode opcode,
- const struct prog_instruction *fpi,
- fs_reg dst, fs_reg src0, fs_reg src1)
-{
-   for (int i = 0; i < 4; i++) {
-  if (fpi->DstReg.WriteMask & (1 << i))
- emit(opcode, offset(dst, i),
-  offset(src0, i), offset(src1, i));
-   }
-}
-
-void
-fs_visitor::emit_fp_minmax(const prog_instruction *fpi,
-   fs_reg dst, fs_reg src0, fs_reg s

Re: [Mesa-dev] [PATCH 0/5] i965/fs: Remove the old visitor code

2015-05-20 Thread Matt Turner
On Wed, May 20, 2015 at 11:09 AM, Jason Ekstrand  wrote:
> Now that we're using NIR by default and everything seems stable there, we
> have about 3000 lines of extra code lying around that we don't need.  We
> might as well delete it. :-)
>
> This series together with one of the patches I sent yesterday can be found
> in the review/fs-nir-only branch on my freedesktop:
>
> http://cgit.freedesktop.org/~jekstrand/mesa/log/?h=review/fs-nir-only

Thanks Jason.

   textdata bss dec hex filename
5040325  192800   26512 5259637  504175 before/i965_dri.so
4932875  193112   26448 5152435  4e9eb3 after/i965_dri.so

Looks like this cuts about 2% of the .text size. Unexpectedly, it
increases the .data size?

I compiled this branch with gcc and clang and didn't see any
additional warnings.

The areas I'm aware of that NIR produces more instructions than the
visitor code are:

 - the texture in then/else cases of an if
 - Missing try_emit_line() for gen <= 5
 - Emits an extra CMP for discards (I've got a WIP patch)
 - Missing emit_gen6_if(). Probably want to do this differently (after
optimizations) anyway

I'm okay with not blocking on any of those.

Do you know of any others?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 79706] [TRACKER] Mesa regression tracker

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

Vinson Lee  changed:

   What|Removed |Added

 Depends on||90539

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


[Mesa-dev] [PATCH 6/5] i965/vs: Rework the logic for generating NIR from ARB vertex programs

2015-05-20 Thread Jason Ekstrand
Whether or not to use NIR is now equivalent to brw->scalar_vs.  We can
simplify the logic and make it far less confusing.
---
 src/mesa/drivers/dri/i965/brw_vec4.cpp | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 02a7e33..a324798 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1868,8 +1868,6 @@ brw_vs_emit(struct brw_context *brw,
bool start_busy = false;
double start_time = 0;
const unsigned *assembly = NULL;
-   bool use_nir =
-  brw->ctx.Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].NirOptions != 
NULL;
 
if (unlikely(brw->perf_debug)) {
   start_busy = (brw->batch.last_bo &&
@@ -1884,17 +1882,18 @@ brw_vs_emit(struct brw_context *brw,
if (unlikely(INTEL_DEBUG & DEBUG_VS))
   brw_dump_ir("vertex", prog, &shader->base, &c->vp->program.Base);
 
-   if (use_nir && !c->vp->program.Base.nir) {
-  /* Normally we generate NIR in LinkShader() or ProgramStringNotify(), but
-   * Mesa's fixed-function vertex program handling doesn't notify the 
driver
-   * at all.  Just do it here, at the last minute, even though it's lame.
-   */
-  assert(c->vp->program.Base.Id == 0 && prog == NULL);
-  c->vp->program.Base.nir =
- brw_create_nir(brw, NULL, &c->vp->program.Base, MESA_SHADER_VERTEX);
-   }
+   if (brw->scalar_vs) {
+  if (!c->vp->program.Base.nir) {
+ /* Normally we generate NIR in LinkShader() or
+  * ProgramStringNotify(), but Mesa's fixed-function vertex program
+  * handling doesn't notify the driver at all.  Just do it here, at
+  * the last minute, even though it's lame.
+  */
+ assert(c->vp->program.Base.Id == 0 && prog == NULL);
+ c->vp->program.Base.nir =
+brw_create_nir(brw, NULL, &c->vp->program.Base, 
MESA_SHADER_VERTEX);
+  }
 
-   if (brw->scalar_vs && (prog || use_nir)) {
   fs_visitor v(brw, mem_ctx, MESA_SHADER_VERTEX, &c->key,
&prog_data->base.base, prog, &c->vp->program.Base, 8);
   if (!v.run_vs()) {
-- 
2.4.1

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


[Mesa-dev] [Bug 90539] [softpipe] piglit varying-packing-simple dmat3 array regression

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

Bug ID: 90539
   Summary: [softpipe] piglit varying-packing-simple dmat3 array
regression
   Product: Mesa
   Version: 10.6
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Keywords: bisected, regression
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: mar...@gmail.com, srol...@vmware.com
Blocks: 79706

mesa: 2126c68e5cba79709e228f12eb3062a9be634a0e (master 10.7.0-devel)

$ ./bin/varying-packing-simple dmat3 array -auto
state_tracker/st_glsl_to_tgsi.cpp:4544:dst_register: Assertion `index <
VARYING_SLOT_MAX' failed.
Trace/breakpoint trap (core dumped)

(gdb) bt
#0  0x7fac1d5be7d6 in _debug_assert_fail (expr=,
file=, line=, function=)
at util/u_debug.c:309
#1  0x7fac1d4784a0 in dst_register (t=t@entry=0x24e7af0, file=, index=)
at state_tracker/st_glsl_to_tgsi.cpp:4544
#2  0x7fac1d489ae3 in translate_dst (clamp_color=false, saturate=false,
dst_reg=, t=0x24e7af0)
at state_tracker/st_glsl_to_tgsi.cpp:4631
#3  compile_tgsi_instruction (clamp_dst_color_output=false, inst=0x24b8700,
t=0x24e7af0) at state_tracker/st_glsl_to_tgsi.cpp:4779
#4  st_translate_program (ctx=, procType=procType@entry=1,
ureg=ureg@entry=0x25011b0, program=, 
proginfo=proginfo@entry=0x244c850, numInputs=,
inputMapping=0x244cda8, inputSemanticName=0x0, inputSemanticIndex=0x0, 
interpMode=0x0, interpLocation=0x0, numOutputs=33, outputMapping=0x244cf70,
outputSemanticName=0x244d050 "", 
outputSemanticIndex=0x244d088 "", passthrough_edgeflags=0 '\000',
clamp_color=0 '\000') at state_tracker/st_glsl_to_tgsi.cpp:5366
#5  0x7fac1d49d44d in st_translate_vertex_program (st=0x22ecb60,
st=0x22ecb60, key=0x7fffde2f9a00, stvp=0x244c850)
at state_tracker/st_program.c:346
#6  st_get_vp_variant (st=st@entry=0x22ecb60, stvp=stvp@entry=0x244c850,
key=key@entry=0x7fffde2f9ab0) at state_tracker/st_program.c:436
#7  0x7fac1d45ec7f in update_vp (st=0x22ecb60) at
state_tracker/st_atom_shader.c:158
#8  0x7fac1d45b725 in st_validate_state (st=st@entry=0x22ecb60) at
state_tracker/st_atom.c:214
#9  0x7fac1d4745ec in st_draw_vbo (ctx=0x7fac225fe010,
prims=0x7fffde2f9c50, nr_prims=1, ib=0x0, index_bounds_valid=, 
min_index=0, max_index=3, tfb_vertcount=0x0, indirect=0x0) at
state_tracker/st_draw.c:199
#10 0x7fac1d43d7f3 in vbo_draw_arrays (ctx=0x7fac225fe010, mode=5, start=0,
count=4, numInstances=1, baseInstance=0)
at vbo/vbo_exec_array.c:645
#11 0x7fac22100633 in stub_glDrawArrays (mode=5, first=0, count=4)
at piglit/tests/util/piglit-dispatch-gen.c:11317
#12 0x7fac22167b54 in piglit_draw_rect_from_arrays (verts=0x7fffde2f9d80,
tex=0x0, use_patches=false)
at piglit/tests/util/piglit-util-gl.c:767
#13 0x7fac22167ce5 in piglit_draw_rect_custom (x=-1, y=-1, w=2, h=2,
use_patches=false)
at piglit/tests/util/piglit-util-gl.c:809
#14 0x7fac22167d4d in piglit_draw_rect (x=-1, y=-1, w=2, h=2) at
piglit/tests/util/piglit-util-gl.c:818
#15 0x0040254f in piglit_display () at
piglit/tests/spec/glsl-1.10/execution/varying-packing/simple.c:466
#16 0x7fac22189f7c in display () at
piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:142
#17 0x7fac21887324 in fghRedrawWindow (window=0x21cfba0) at
freeglut_main.c:231
#18 fghcbDisplayWindow (window=0x21cfba0, enumerator=0x7fffde2f9f00) at
freeglut_main.c:248
#19 0x7fac2188ab89 in fgEnumWindows
(enumCallback=enumCallback@entry=0x7fac218872b0 , 
enumerator=enumerator@entry=0x7fffde2f9f00) at freeglut_structure.c:396
#20 0x7fac218878dd in fghDisplayAll () at freeglut_main.c:271
#21 glutMainLoopEvent () at freeglut_main.c:1523
#22 0x7fac218880dd in glutMainLoop () at freeglut_main.c:1571
#23 0x7fac2218a340 in run_test (gl_fw=0x7fac22402b40 , argc=3,
argv=0x7fffde2fa2e8)
at piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:292
#24 0x7fac22170913 in piglit_gl_test_run (argc=3, argv=0x7fffde2fa2e8,
config=0x7fffde2fa1a0)
at piglit/tests/util/piglit-framework-gl.c:182
#25 0x004018ad in main (argc=3, argv=0x7fffde2fa2e8)
at piglit/tests/spec/glsl-1.10/execution/varying-packing/simple.c:108
(gdb) frame 1
#1  0x7fac1d4784a0 in dst_register (t=t@entry=0x24e7af0, file=, index=)
at state_tracker/st_glsl_to_tgsi.cpp:4544
4544 assert(index < VARYING_SLOT_MAX);

7ffc1fb928268f8493e88d45e9a006208d05f0f6 is the first bad commit
commit 7ffc1fb928268f8493e88d45e9a006208d05f0f6
Author: Marek Olšák 
Date:   Thu Mar 19 23:27:10 2015 +0100

gallium: bump shader input and output limits

Reviewed-by: Roland Scheidegger 
Signed-off-by: Marek Olšák 

:04 04 c8ba9549231eff63c36137320a597d5

Re: [Mesa-dev] [PATCH 0/5] i965/fs: Remove the old visitor code

2015-05-20 Thread Jason Ekstrand
On Wed, May 20, 2015 at 12:02 PM, Matt Turner  wrote:
> On Wed, May 20, 2015 at 11:09 AM, Jason Ekstrand  wrote:
>> Now that we're using NIR by default and everything seems stable there, we
>> have about 3000 lines of extra code lying around that we don't need.  We
>> might as well delete it. :-)
>>
>> This series together with one of the patches I sent yesterday can be found
>> in the review/fs-nir-only branch on my freedesktop:
>>
>> http://cgit.freedesktop.org/~jekstrand/mesa/log/?h=review/fs-nir-only
>
> Thanks Jason.
>
>textdata bss dec hex filename
> 5040325  192800   26512 5259637  504175 before/i965_dri.so
> 4932875  193112   26448 5152435  4e9eb3 after/i965_dri.so
>
> Looks like this cuts about 2% of the .text size. Unexpectedly, it
> increases the .data size?
>
> I compiled this branch with gcc and clang and didn't see any
> additional warnings.
>
> The areas I'm aware of that NIR produces more instructions than the
> visitor code are:
>
>  - the texture in then/else cases of an if
>  - Missing try_emit_line() for gen <= 5
>  - Emits an extra CMP for discards (I've got a WIP patch)
>  - Missing emit_gen6_if(). Probably want to do this differently (after
> optimizations) anyway
>
> I'm okay with not blocking on any of those.
>
> Do you know of any others?

Not off-hand.  When we throw in GCM, we start having issues with CMP
instructions being too far away from their use and not cmod
propagation not working.  However, that's not really a problem at the
moment.
--Jason
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 25898] glEvalPoint causes glEnd to throw GL_INVALID_OPERATION

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

Brian Paul  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Brian Paul  ---
I just retested this app with Mesa master (git 4445bbf) and I don't see any
errors.  Probably fixed long since Mesa 7.6.  Closing.

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


[Mesa-dev] [Bug 79706] [TRACKER] Mesa regression tracker

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

--- Comment #1 from Matt Turner  ---
I don't know what we were thinking by opening a non-versioned "regression
tracker" bug. It's like a meta-bugzilla. Can we stop this?

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


[Mesa-dev] [Bug 90542] [softpipe] piglit glsl-1.50-gs-mismatch-prim-type lines_adjacency regression

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

Bug ID: 90542
   Summary: [softpipe] piglit glsl-1.50-gs-mismatch-prim-type
lines_adjacency regression
   Product: Mesa
   Version: 10.6
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Keywords: bisected, regression
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: mar...@gmail.com, srol...@vmware.com

mesa: 2126c68e5cba79709e228f12eb3062a9be634a0e (master 10.7.0-devel)

$ ./bin/glsl-1.50-gs-mismatch-prim-type lines_adjacency -auto
Mesa: User error: GL_INVALID_OPERATION in glDrawElements(mode=GL_POINTS vs
geometry shader input GL_LINES_ADJACENCY)
Mesa: User error: GL_INVALID_OPERATION in glDrawElements(mode=GL_LINES vs
geometry shader input GL_LINES_ADJACENCY)
Mesa: User error: GL_INVALID_OPERATION in glDrawElements(mode=GL_LINE_STRIP vs
geometry shader input GL_LINES_ADJACENCY)
Mesa: User error: GL_INVALID_OPERATION in glDrawElements(mode=GL_LINE_LOOP vs
geometry shader input GL_LINES_ADJACENCY)
tgsi/tgsi_exec.c:1265:fetch_src_file_channel: Assertion `pos < 6 * 32' failed.
Trace/breakpoint trap (core dumped)

(gdb) bt
#0  0x7fbe95ea47d6 in _debug_assert_fail (expr=expr@entry=0x7fbe95fcd551
"pos < 6 * 32", 
file=file@entry=0x7fbe95fcd50f "tgsi/tgsi_exec.c", line=line@entry=1265, 
function=function@entry=0x7fbe95fcdeb0 <__func__.7350>
"fetch_src_file_channel") at util/u_debug.c:309
#1  0x7fbe95e87247 in fetch_src_file_channel
(mach=mach@entry=0x7fbe93fb7010, file=, swizzle=, 
index=index@entry=0x7ffcb8f7ef40, index2D=index2D@entry=0x7ffcb8f7ef50,
chan=chan@entry=0x7ffcb8f7f010, chan_index=0)
at tgsi/tgsi_exec.c:1265
#2  0x7fbe95e878ed in fetch_source_d (mach=mach@entry=0x7fbe93fb7010,
chan=chan@entry=0x7ffcb8f7f010, reg=reg@entry=0x7292e0, 
chan_index=chan_index@entry=0, src_datatype=TGSI_EXEC_DATA_FLOAT) at
tgsi/tgsi_exec.c:1474
#3  0x7fbe95e87a92 in fetch_source (mach=mach@entry=0x7fbe93fb7010,
chan=chan@entry=0x7ffcb8f7f010, reg=reg@entry=0x7292e0, 
chan_index=chan_index@entry=0,
src_datatype=src_datatype@entry=TGSI_EXEC_DATA_FLOAT) at tgsi/tgsi_exec.c:1490
#4  0x7fbe95e886a8 in exec_vector_unary (mach=0x7fbe93fb7010,
inst=0x7292b0, op=op@entry=0x7fbe95e85180 , 
src_datatype=src_datatype@entry=TGSI_EXEC_DATA_FLOAT,
dst_datatype=TGSI_EXEC_DATA_UINT) at tgsi/tgsi_exec.c:2734
#5  0x7fbe95e8cefe in exec_instruction (mach=mach@entry=0x7fbe93fb7010,
inst=0x7292b0, pc=pc@entry=0x7ffcb8f7f274)
at tgsi/tgsi_exec.c:4128
#6  0x7fbe95e8eec7 in tgsi_exec_machine_run
(mach=mach@entry=0x7fbe93fb7010) at tgsi/tgsi_exec.c:5113
#7  0x7fbe95e55105 in tgsi_gs_run (shader=,
input_primitives=) at draw/draw_gs.c:210
#8  0x7fbe95e55180 in gs_flush (shader=0xbdee30) at draw/draw_gs.c:408
#9  0x7fbe95e553b8 in gs_line_adj (shader=0xbdee30, i0=,
i1=, i2=, i3=)
at draw/draw_gs.c:470
#10 0x7fbe95e56517 in gs_run_elts (input_verts=,
output_prims=, output_verts=, 
input_prims=, gs=) at
draw/draw_decompose_tmp.h:312
#11 draw_geometry_shader_run (shader=0xbdee30, constants=0x7fbe9a7549f0
<_IO_stdfile_2_lock>, constants_size=0x0, input_verts=0x72614a, 
input_prim=0x7ffcb8f7f510, input_info=0x1, output_verts=0x7ffcb8f7f3f0,
output_prims=0x7ffcb8f7f430) at draw/draw_gs.c:631
#12 0x7fbe95e66e97 in fetch_pipeline_generic (middle=0x6638c0,
fetch_info=0x7fbe9a7549f0 <_IO_stdfile_2_lock>, 
fetch_info@entry=0x7ffcb8f7f4f0, in_prim_info=0x7ffcb8f7f510) at
draw/draw_pt_fetch_shade_pipeline.c:290
#13 0x7fbe95e67273 in fetch_pipeline_run (middle=,
fetch_elts=, fetch_count=, 
draw_elts=, draw_count=4, prim_flags=) at
draw/draw_pt_fetch_shade_pipeline.c:388
#14 0x7fbe95e72644 in vsplit_flush_cache (flags=,
vsplit=) at draw/draw_pt_vsplit.c:79
#15 vsplit_segment_cache_uint (iclose=, close=,
ispoken=, spoken=, 
icount=, istart=, flags=,
vsplit=) at draw/draw_pt_vsplit_tmp.h:184
#16 vsplit_segment_simple_uint (icount=, istart=,
flags=, vsplit=)
at draw/draw_pt_vsplit_tmp.h:193
#17 vsplit_run_uint (frontend=0x725100, start=0, count=4) at
draw/draw_split_tmp.h:60
#18 0x7fbe95e64205 in draw_pt_arrays (draw=draw@entry=0x663c90, prim=10,
start=0, count=count@entry=4) at draw/draw_pt.c:149
#19 0x7fbe95e64833 in draw_vbo (draw=draw@entry=0x663c90,
info=0x7ffcb8f7f680, info@entry=0x7ffcb8f7f780) at draw/draw_pt.c:564
#20 0x7fbe95f07dfa in softpipe_draw_vbo (pipe=0x66d7b0,
info=0x7ffcb8f7f780) at sp_draw_arrays.c:147
#21 0x7fbe95d5a7c0 in st_draw_vbo (ctx=, prims=, nr_prims=, ib=0x7ffcb8f7f840, 
index_bounds_valid=, min_index=4294967295,
max_index=4294967295, tfb_vertcount=0x0, indirect=0x0)
at state_tracker/st_draw.c:286
#22 0x7fbe95d24034 in vbo_validated_drawrangeelem

Re: [Mesa-dev] [PATCH:mesa] swrast: Build fix for Solaris

2015-05-20 Thread Emil Velikov
On 17 May 2015 at 14:23, Jon TURNEY  wrote:
> On 16/05/2015 05:12, Alan Coopersmith wrote:
>>
>> Ah yes, I see Jons patch now in
>> https://bugs.freedesktop.org/show_bug.cgi?id=90147#c9
>>
>> That looks like it should work for Solaris too, so whichever the
>> Mesa developers prefer...
>
>
> Alan's patch is clearly superior, so please apply.
>
Pushed to master.

This commit (and the one that fixes the original Mac issue) will land
in 10.5 and 10.6 shortly.

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


Re: [Mesa-dev] [PATCH] darwin: Fix install name of libOSMesa

2015-05-20 Thread Emil Velikov
Hi Jeremy,

On 11 February 2015 at 18:00, Jeremy Huddleston Sequoia
 wrote:
>
>> On Feb 11, 2015, at 05:02, Emil Velikov  wrote:
>>
>> On 11 February 2015 at 10:32, Jeremy Huddleston Sequoia
>>  wrote:
>>> libOSMesa is a library, not a module
>>>
>> Fwiw I'm not 100% sure that's the case. But considering it's been like
>> that* for a long time we should be safe.
>> Just a couple small requests - can you clarify what you mean with "Fix
>> install name"
>
> Passing -module to glibtool causes the resulting library to be called 
> libSomething.so rather than libSomething.dylib on darwin.
>
>> and update the gallium one (src/gallium/targets/osmesa).
>
> I can do that, but I can't test it since gallium doesn't build on darwin, so 
> I'd prefer to leave that alone for now.
>
Sorry about the delay. I've added your description of the problem to
the commit message and pushed to master (10.5 & 10.6 will have it as
well). I've went ahead with the gallium version as well.

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


Re: [Mesa-dev] [PATCH] glext.h: Add missing include of stddef.h for ptrdiff_t

2015-05-20 Thread Emil Velikov
Hi Jeremy,

On 11 February 2015 at 20:36, Jeremy Huddleston Sequoia
 wrote:
>
> Signed-off-by: Jeremy Huddleston Sequoia 
> ---
>  include/GL/glext.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/include/GL/glext.h b/include/GL/glext.h
> index 256ad35..0328cf6 100644
> --- a/include/GL/glext.h
> +++ b/include/GL/glext.h
> @@ -4470,6 +4470,7 @@ GLAPI void APIENTRY glVertexBlendARB (GLint count);
>
>  #ifndef GL_ARB_vertex_buffer_object
>  #define GL_ARB_vertex_buffer_object 1
> +#include 
As Matt pointed out the headers are coming directly from Khronos and
we should not modify them. Did you had the change to report this issue
to them ?

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


[Mesa-dev] [Bug 58812] Infinite loop in ./configure && make if automake is absent

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

Matt Turner  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Matt Turner  ---
I assume this has been fixed since we're now using make dist to generate the
tarballs. Reopen if not.

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


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

2015-05-20 Thread Timothy Arceri
On Thu, 2015-05-14 at 22:49 +0200, Alejandro Piñeiro wrote:
> On 14/05/15 20:38, Ian Romanick wrote:
> > On 05/14/2015 04:30 AM, Timothy Arceri wrote:
> >> On Wed, 2015-05-13 at 09:58 -0700, Ian Romanick wrote:
> >>> On 05/11/2015 03:37 AM, Alejandro Piñeiro wrote:
>  Since commit c0cd5b var->data.binding was set only when explicit_binding
>  was false, thas was wrong, should be a test to true. This prevented
>  to use any binding point different to 0.
> 
>  In any case, that if statement is not needed. Right now mesa requires
>  all atomic counters to have an explicit binding point. This would match
>  the original implementation.
> 
>  Cc: 10.4, 10.5 
> >>>   ^^ You should put quotes around this, or it treats it as
> >>> two separate e-mail addresses.  One is 10.4 (invalid) and the other use
> >>> a user named "10.5" at the address mesa-sta...@lists.freedesktop.org
> >>> (valid).
> >>>
>  Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90175
>  ---
> 
>  New version based on Timothy Arceri suggestion at the list. Also
>  gentle ping for a formal review of the patch.
> 
>   src/glsl/link_atomics.cpp | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
>  diff --git a/src/glsl/link_atomics.cpp b/src/glsl/link_atomics.cpp
>  index 603873a..2cede91 100644
>  --- a/src/glsl/link_atomics.cpp
>  +++ b/src/glsl/link_atomics.cpp
>  @@ -201,8 +201,7 @@ link_assign_atomic_counter_resources(struct 
>  gl_context *ctx,
>    gl_uniform_storage *const storage = &prog->UniformStorage[id];
>   
>    mab.Uniforms[j] = id;
>  - if (!var->data.explicit_binding)
>  -var->data.binding = i;
>  + var->data.binding = i;
> >>> I don't think this is correct.  If the user specified an explicit
> >>> binding, which you correctly assert is required, this will overwrite
> >>> that value with some other value.  See src/glsl/ast_to_hir.cpp around
> >>> line 2663.  I suspect the value of ir_variable::data.binding is just
> >>> getting lost somewhere (probably not being copied), and your change just
> >>> fixes it by luck.
> >> I thought the same thing when I first looked at this but running it in
> >> the debugger showed the value in ir_variable::data.binding was correct
> >> and it wasn't just working by luck.
> >>
> >> find_active_atomic_counters() finds all the active counters which are
> >> then packed into prog->AtomicBuffers. The code seems to expect
> >> data.binding to be changed to point to its new packed location in
> >> prog->AtomicBuffers.
> >>
> >>> What happens if you change your test to use binding 3 instead of 1?
> >> It works correctly with the patch and fails without.
> > I think I see what's happening.  I don't think I understood
> > atomic.buffer_index well enough when I removed it. :(  In binding=3
> > case, what value does
> >
> > glGetActiveAtomicCounterBufferiv(prog,
> >  0,
> >  GL_ATOMIC_COUNTER_BUFFER_BINDING,
> >  param);
> >
> > give?  My guess is that it gives 0 instead of the binding specified in
> > the shader.
> 
> With the test I uploaded today, so with binding points 3 and 6, and
> using index 0 and 1, calling glGetActiveAtomicCounterBufferiv properly
> returns 3 and 6. Both with and without the patch of this thread.

The correct binding is stored in the gl_active_atomic_buffer struct
which queried by glGetActiveAtomicCounterBufferiv()


> 
> >   This would be a good addition to the test.
> 
> Ok.
> 
> > The index and the binding are different.  The index is "which atomic is
> > this in the shader," and the binding is "which binding point is used to
> > attach a buffer to this atomic."  Thanks to c0cd5b, I think somewhere
> > we're using one value when we actually want the other... probably the
> > last hunk:
> >
> > --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> > +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> > @@ -2294,7 +2294,7 @@
> > vec4_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
> >ir->actual_parameters.get_head());
> > ir_variable *location = deref->variable_referenced();
> > unsigned surf_index = (prog_data->base.binding_table.abo_start +
> > -  location->data.atomic.buffer_index);
> > +  location->data.binding);
> >
> > /* Calculate the surface offset */
> > src_reg offset(this, glsl_type::uint_type);
> >
> > Maybe try adding a utility function that will search
> > gl_shader_program::UniformStorage for location->name and use the
> > atomic_buffer_index stored there for use in the i965 driver?
> 
> Taking into account that glGetActiveAtomicCounterBufferiv is already
> working, do you think that this is still needed?

For clarity its probably a good idea to implement Ian's suggestion.
Changing the bin

Re: [Mesa-dev] [PATCH] glext.h: Add missing include of stddef.h for ptrdiff_t

2015-05-20 Thread Jeremy Huddleston Sequoia
> On May 20, 2015, at 13:59, Emil Velikov  wrote:
> 
> Hi Jeremy,
> 
> On 11 February 2015 at 20:36, Jeremy Huddleston Sequoia
>  wrote:
>> 
>> Signed-off-by: Jeremy Huddleston Sequoia 
>> ---
>> include/GL/glext.h | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/include/GL/glext.h b/include/GL/glext.h
>> index 256ad35..0328cf6 100644
>> --- a/include/GL/glext.h
>> +++ b/include/GL/glext.h
>> @@ -4470,6 +4470,7 @@ GLAPI void APIENTRY glVertexBlendARB (GLint count);
>> 
>> #ifndef GL_ARB_vertex_buffer_object
>> #define GL_ARB_vertex_buffer_object 1
>> +#include 
> As Matt pointed out the headers are coming directly from Khronos and
> we should not modify them. Did you had the change to report this issue
> to them ?

I don't think I did.

I have now: https://www.khronos.org/bugzilla/show_bug.cgi?id=1345


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


[Mesa-dev] [PATCH 03/27] glapi: remap_helper.py: Fix some low hanging style issues

2015-05-20 Thread Dylan Baker
From: Dylan Baker 

This makes the tools shut up about a bunch of problems, making them more
useful for catching actual problems.

Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/remap_helper.py | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/mapi/glapi/gen/remap_helper.py 
b/src/mapi/glapi/gen/remap_helper.py
index e1a13d0..d34e1b5 100644
--- a/src/mapi/glapi/gen/remap_helper.py
+++ b/src/mapi/glapi/gen/remap_helper.py
@@ -24,9 +24,12 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-import gl_XML
+import sys
+import getopt
+
 import license
-import sys, getopt, string
+import gl_XML
+
 
 def get_function_spec(func):
 sig = ""
@@ -54,6 +57,7 @@ def get_function_spec(func):
 
 return spec
 
+
 class PrintGlRemap(gl_XML.gl_print_base):
 def __init__(self):
 gl_XML.gl_print_base.__init__(self)
@@ -168,12 +172,13 @@ def show_usage():
 print "-c verVersion can be 'es1' or 'es2'."
 sys.exit(1)
 
-if __name__ == '__main__':
+
+def main():
 file_name = "gl_API.xml"
 
 try:
 (args, trail) = getopt.getopt(sys.argv[1:], "f:c:")
-except Exception,e:
+except Exception:
 show_usage()
 
 es = None
@@ -190,3 +195,7 @@ if __name__ == '__main__':
 
 printer = PrintGlRemap()
 printer.Print( api )
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 07/27] glapi: gl_enums.py: use argparse instead of getopt.

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_enums.py | 30 ++
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index f45782d..927a68b 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -1,8 +1,8 @@
 #!/usr/bin/python2
 # -*- Mode: Python; py-indent-offset: 8 -*-
 
-# (C) Copyright Zack Rusin 2005
-# All Rights Reserved.
+# (C) Copyright Zack Rusin 2005. All Rights Reserved.
+# Copyright (C) 2015 Intel Corporation
 # 
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -26,6 +26,8 @@
 # Authors:
 #Zack Rusin 
 
+import argparse
+
 import license
 import gl_XML
 import sys, getopt
@@ -201,21 +203,17 @@ _mesa_lookup_prim_by_nr(GLuint nr)
 enum.append( [name, priority] )
 
 
-def show_usage():
-print "Usage: %s [-f input_file_name]" % sys.argv[0]
-sys.exit(1)
+def _parser():
+parser = argparse.ArgumentParser()
+parser.add_argument('-f', '--input_file',
+required=True,
+help="Choose an xml file to parse.")
+return parser.parse_args()
 
-if __name__ == '__main__':
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "f:")
-except Exception,e:
-show_usage()
 
-api_list = []
-for (arg,val) in args:
-if arg == "-f":
-api = gl_XML.parse_GL_API( val )
-api_list.append(api);
+if __name__ == '__main__':
+args = _parser()
+api_list = [gl_XML.parse_GL_API(args.input_file)]
 
 printer = PrintGlEnums()
-printer.Print( api_list )
+printer.Print(api_list)
-- 
2.4.1

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


[Mesa-dev] [PATCH 04/27] glapi: remap_helper.py: use argparse instead of optparse

2015-05-20 Thread Dylan Baker
From: Dylan Baker 

Make the code simpler, cleaner, and easier to work with.

Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/remap_helper.py | 46 ++
 1 file changed, 22 insertions(+), 24 deletions(-)

diff --git a/src/mapi/glapi/gen/remap_helper.py 
b/src/mapi/glapi/gen/remap_helper.py
index d34e1b5..9e3c390 100644
--- a/src/mapi/glapi/gen/remap_helper.py
+++ b/src/mapi/glapi/gen/remap_helper.py
@@ -24,8 +24,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-import sys
-import getopt
+import argparse
 
 import license
 import gl_XML
@@ -167,34 +166,33 @@ class PrintGlRemap(gl_XML.gl_print_base):
 return
 
 
-def show_usage():
-print "Usage: %s [-f input_file_name] [-c ver]" % sys.argv[0]
-print "-c verVersion can be 'es1' or 'es2'."
-sys.exit(1)
+def _parser():
+"""Parse input options and return a namsepace."""
+parser = argparse.ArgumentParser()
+parser.add_argument('-f', '--filename',
+type=gl_XML.parse_GL_API,
+default="gl_API.xml",
+metavar="input_file_name",
+dest='api',
+help="An xml description file.")
+parser.add_argument('-c', '--es-version',
+choices=[None, 'es1', 'es2'],
+default=None,
+metavar='ver',
+dest='es',
+help='A GLES version to support')
+return parser.parse_args()
 
 
 def main():
-file_name = "gl_API.xml"
+"""Main function."""
+args = _parser()
 
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "f:c:")
-except Exception:
-show_usage()
-
-es = None
-for (arg,val) in args:
-if arg == "-f":
-file_name = val
-elif arg == "-c":
-es = val
-
-api = gl_XML.parse_GL_API( file_name )
-
-if es is not None:
-api.filter_functions_by_api(es)
+if args.es is not None:
+args.api.filter_functions_by_api(args.es)
 
 printer = PrintGlRemap()
-printer.Print( api )
+printer.Print(args.api)
 
 
 if __name__ == '__main__':
-- 
2.4.1

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


[Mesa-dev] [PATCH 10/27] glapi: gl_apitemp.py: Use a main function

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_apitemp.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_apitemp.py b/src/mapi/glapi/gen/gl_apitemp.py
index 7647428..5e985a2 100644
--- a/src/mapi/glapi/gen/gl_apitemp.py
+++ b/src/mapi/glapi/gen/gl_apitemp.py
@@ -317,10 +317,15 @@ def _parser():
 return parser.parse_args()
 
 
-if __name__ == '__main__':
+def main():
+"""Main function."""
 args = _parser()
 
 api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 
 printer = PrintGlOffsets(args.es)
 printer.Print(api)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 05/27] glapi: gl_procs.py: Fix a few long hanging style things

2015-05-20 Thread Dylan Baker
From: Dylan Baker 

Shuts up analysis tools to make them return actual problems.

Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_procs.py | 23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_procs.py b/src/mapi/glapi/gen/gl_procs.py
index b1fffc4..d5ffb92 100644
--- a/src/mapi/glapi/gen/gl_procs.py
+++ b/src/mapi/glapi/gen/gl_procs.py
@@ -25,9 +25,13 @@
 # Authors:
 #Ian Romanick 
 
+import sys
+import getopt
+
 import license
-import gl_XML, glX_XML
-import sys, getopt
+import gl_XML
+import glX_XML
+
 
 class PrintGlProcs(gl_XML.gl_print_base):
 def __init__(self, es=False):
@@ -39,7 +43,6 @@ class PrintGlProcs(gl_XML.gl_print_base):
 """Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
 (C) Copyright IBM Corporation 2004, 2006""", "BRIAN PAUL, IBM")
 
-
 def printRealHeader(self):
 print """
 /* This file is only included by glapi.c and is used for
@@ -166,16 +169,18 @@ def show_usage():
 print "-c  Enable compatibility with OpenGL ES."
 sys.exit(1)
 
-if __name__ == '__main__':
+
+def main():
+"""Main function."""
 file_name = "gl_API.xml"
 
 try:
-(args, trail) = getopt.getopt(sys.argv[1:], "f:c")
-except Exception,e:
+args, _ = getopt.getopt(sys.argv[1:], "f:c")
+except Exception:
 show_usage()
 
 es = False
-for (arg,val) in args:
+for arg, val in args:
 if arg == "-f":
 file_name = val
 elif arg == "-c":
@@ -184,3 +189,7 @@ if __name__ == '__main__':
 api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
 printer = PrintGlProcs(es)
 printer.Print(api)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 01/27] glapi: gl_table.py: Fix some low hanging style issues

2015-05-20 Thread Dylan Baker
From: Dylan Baker 

Making the tools shut up about worthless errors so you can see real ones
is very useful

Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_table.py | 42 ++
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py
index fd38468..3245625 100644
--- a/src/mapi/glapi/gen/gl_table.py
+++ b/src/mapi/glapi/gen/gl_table.py
@@ -2,6 +2,7 @@
 
 # (C) Copyright IBM Corporation 2004
 # All Rights Reserved.
+# Copyright (c) 2014 Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -25,9 +26,12 @@
 # Authors:
 #Ian Romanick 
 
+import sys
+import getopt
+
 import gl_XML
 import license
-import sys, getopt
+
 
 class PrintGlTable(gl_XML.gl_print_base):
 def __init__(self, es=False):
@@ -39,21 +43,20 @@ class PrintGlTable(gl_XML.gl_print_base):
 self.license = license.bsd_license_template % ( \
 """Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
 (C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
-self.ifdef_emitted = False;
+self.ifdef_emitted = False
 return
 
-
 def printBody(self, api):
 for f in api.functionIterateByOffset():
 if not f.is_abi() and not self.ifdef_emitted:
 print '#if !defined HAVE_SHARED_GLAPI'
 self.ifdef_emitted = True
 arg_string = f.get_parameter_string()
-print '   %s (GLAPIENTRYP %s)(%s); /* %d */' % (f.return_type, 
f.name, arg_string, f.offset)
+print '   %s (GLAPIENTRYP %s)(%s); /* %d */' % (
+f.return_type, f.name, arg_string, f.offset)
 
 print '#endif /* !defined HAVE_SHARED_GLAPI */'
 
-
 def printRealHeader(self):
 print '#ifndef GLAPIENTRYP'
 print '# ifndef GLAPIENTRY'
@@ -68,7 +71,6 @@ class PrintGlTable(gl_XML.gl_print_base):
 print '{'
 return
 
-
 def printRealFooter(self):
 print '};'
 return
@@ -81,7 +83,8 @@ class PrintRemapTable(gl_XML.gl_print_base):
 self.es = es
 self.header_tag = '_DISPATCH_H_'
 self.name = "gl_table.py (from Mesa)"
-self.license = license.bsd_license_template % ("(C) Copyright IBM 
Corporation 2005", "IBM")
+self.license = license.bsd_license_template % (
+"(C) Copyright IBM Corporation 2005", "IBM")
 return
 
 
@@ -100,6 +103,7 @@ class PrintRemapTable(gl_XML.gl_print_base):
 """
 return
 
+
 def printBody(self, api):
 print '#define CALL_by_offset(disp, cast, offset, parameters) \\'
 print '(*(cast (GET_by_offset(disp, offset parameters'
@@ -124,10 +128,10 @@ class PrintRemapTable(gl_XML.gl_print_base):
 count = 0
 for f in api.functionIterateByOffset():
 if not f.is_abi():
-functions.append( [f, count] )
+functions.append([f, count])
 count += 1
 else:
-abi_functions.append( [f, -1] )
+abi_functions.append([f, -1])
 
 if self.es:
 # remember functions with aliases
@@ -165,7 +169,7 @@ class PrintRemapTable(gl_XML.gl_print_base):
 print ''
 
 for f, index in abi_functions + functions:
-arg_string = gl_XML.create_parameter_string( f.parameters, 0 )
+arg_string = gl_XML.create_parameter_string(f.parameters, 0)
 
 print 'typedef %s (GLAPIENTRYP _glptr_%s)(%s);' % (f.return_type, 
f.name, arg_string)
 print '#define CALL_%s(disp, parameters) \\' % (f.name)
@@ -205,17 +209,19 @@ def show_usage():
 print "-c verVersion can be 'es1' or 'es2'."
 sys.exit(1)
 
-if __name__ == '__main__':
+
+def main():
+"""Main function."""
 file_name = "gl_API.xml"
 
 try:
-(args, trail) = getopt.getopt(sys.argv[1:], "f:m:c:")
-except Exception,e:
+args, _ = getopt.getopt(sys.argv[1:], "f:m:c:")
+except Exception:
 show_usage()
 
 mode = "table"
 es = None
-for (arg,val) in args:
+for (arg, val) in args:
 if arg == "-f":
 file_name = val
 elif arg == "-m":
@@ -230,9 +236,13 @@ if __name__ == '__main__':
 else:
 show_usage()
 
-api = gl_XML.parse_GL_API( file_name )
+api = gl_XML.parse_GL_API(file_name)
 
 if es is not None:
 api.filter_functions_by_api(es)
 
-printer.Print( api )
+printer.Print(api)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 11/27] glapi: gl_gentable.py: Replace getopt with argparse

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_gentable.py | 29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_gentable.py 
b/src/mapi/glapi/gen/gl_gentable.py
index 06a5ebf..f7ffaf0 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -2,6 +2,7 @@
 
 # (C) Copyright IBM Corporation 2004, 2005
 # (C) Copyright Apple Inc. 2011
+# Copyright (C) 2015 Itnel Corporation
 # All Rights Reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
@@ -29,9 +30,10 @@
 # Based on code ogiginally by:
 #Ian Romanick 
 
+import argparse
+
 import license
 import gl_XML, glX_XML
-import sys, getopt
 
 header = """/* GLXEXT is the define used in the xserver when the GLX extension 
is being
  * built.  Hijack this to determine whether this file is being built for the
@@ -186,23 +188,22 @@ class PrintCode(gl_XML.gl_print_base):
 print body_template % vars
 return
 
-def show_usage():
-print "Usage: %s [-f input_file_name]" % sys.argv[0]
-sys.exit(1)
 
-if __name__ == '__main__':
-file_name = "gl_API.xml"
+def _parser():
+"""Parse arguments and return a namespace object."""
+parser = argparse.ArgumentParser()
+parser.add_argument('-f',
+dest='filename',
+default='gl_API.xml',
+help='An XML file description of an API')
 
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
-except Exception,e:
-show_usage()
+return parser.parse_args()
 
-for (arg,val) in args:
-if arg == "-f":
-file_name = val
+
+if __name__ == '__main__':
+args = _parser()
 
 printer = PrintCode()
 
-api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 printer.Print(api)
-- 
2.4.1

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


[Mesa-dev] [PATCH 12/27] glapi: gl_gentable.py: use a main function

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_gentable.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_gentable.py 
b/src/mapi/glapi/gen/gl_gentable.py
index f7ffaf0..32c1b68 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -200,10 +200,15 @@ def _parser():
 return parser.parse_args()
 
 
-if __name__ == '__main__':
+def main():
+"""Main function."""
 args = _parser()
 
 printer = PrintCode()
 
 api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 printer.Print(api)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 02/27] glapi: gl_table.py: replace getopt with argparse.

2015-05-20 Thread Dylan Baker
From: Dylan Baker 

This results in slightly less code, but code that is much more readable.
It has the advantage of putting everything together in one place, all of
the code is self documenting, help messages are auto-generated, choices
are automatically enforced, and the syntax is much less C like, taking
advantage of python features and idioms.

Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_table.py | 70 --
 1 file changed, 33 insertions(+), 37 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py
index 3245625..30903fd 100644
--- a/src/mapi/glapi/gen/gl_table.py
+++ b/src/mapi/glapi/gen/gl_table.py
@@ -26,8 +26,7 @@
 # Authors:
 #Ian Romanick 
 
-import sys
-import getopt
+import argparse
 
 import gl_XML
 import license
@@ -203,45 +202,42 @@ class PrintRemapTable(gl_XML.gl_print_base):
 return
 
 
-def show_usage():
-print "Usage: %s [-f input_file_name] [-m mode] [-c ver]" % sys.argv[0]
-print "-m mode   Mode can be 'table' or 'remap_table'."
-print "-c verVersion can be 'es1' or 'es2'."
-sys.exit(1)
+def _parser():
+"""Parse arguments and return a namespace."""
+parser = argparse.ArgumentParser()
+parser.add_argument('-f', '--filename',
+type=gl_XML.parse_GL_API,
+default='gl_API.xml',
+metavar="input_file_name",
+dest='api',
+help="Path to an XML description of OpenGL API.")
+parser.add_argument('-m', '--mode',
+choices=['table', 'remap_table'],
+default='table',
+metavar="mode",
+help="Generate either a table or a remap_table")
+parser.add_argument('-c', '--es-version',
+choices=[None, 'es1', 'es2'],
+default=None,
+metavar="ver",
+dest='es',
+help="filter functions for es")
+return parser.parse_args()
 
 
 def main():
 """Main function."""
-file_name = "gl_API.xml"
-
-try:
-args, _ = getopt.getopt(sys.argv[1:], "f:m:c:")
-except Exception:
-show_usage()
-
-mode = "table"
-es = None
-for (arg, val) in args:
-if arg == "-f":
-file_name = val
-elif arg == "-m":
-mode = val
-elif arg == "-c":
-es = val
-
-if mode == "table":
-printer = PrintGlTable(es)
-elif mode == "remap_table":
-printer = PrintRemapTable(es)
-else:
-show_usage()
-
-api = gl_XML.parse_GL_API(file_name)
-
-if es is not None:
-api.filter_functions_by_api(es)
-
-printer.Print(api)
+args = _parser()
+
+if args.mode == "table":
+printer = PrintGlTable(args.es)
+elif args.mode == "remap_table":
+printer = PrintRemapTable(args.es)
+
+if args.es is not None:
+args.api.filter_functions_by_api(args.es)
+
+printer.Print(args.api)
 
 
 if __name__ == '__main__':
-- 
2.4.1

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


[Mesa-dev] glapi: use only one kind of argument parser in python generators

2015-05-20 Thread Dylan Baker
This is a small slice of a larger series I'm working on with the end
goal of using mako, the khronos XML, and being python3 compatible with
our generators. That series is over 100 patches already, and not even
finished with the first step of using mako. I've sent this out to get
some patches landed.

I've tested this with python 2.7 and 2.6. There is the catch that
argparse became part of the standard library in 2.7, so 2.6 users will
need to install argparse themselves, either with pip (pip install
argparse) or via their package manager (most distros with python 2.6
package this). It seems to me that since python 2.6 was deprecated in
octobor of 2013 it seem silly to support anything older (which would
have a deprecation date in 2012 or before), and widens the gap between
python 2 and python 3 both feature wise and syntax wise.

Currently we use a mixture of getopt, optparse, and raw sys.argv munging
to get command line arguments. Argparse is the de facto standard for
python programs, it's clean, powerful, easy to understand, and it does
everything in one place. It doesn't allow a usage() function to drift
out of sync from the actual implementation, since the majority of the
help message is auto generated, and the rest is part of the actual
definition.

This also moves to using the standard python idiom of a main() function
called in the 'if __name__ == "__main__"' guard. This is an extremely
common pattern, and it makes the code much cleaner.

This is available on freedesktop.org:
git://people.freedesktop.org/~dbaker/mesa submit/generator-argparse

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


[Mesa-dev] [PATCH 08/27] glapi: gl_enums.py: use main() function for if __name__ == "__main__"

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_enums.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index 927a68b..955f27d 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -211,9 +211,13 @@ def _parser():
 return parser.parse_args()
 
 
-if __name__ == '__main__':
+def main():
 args = _parser()
 api_list = [gl_XML.parse_GL_API(args.input_file)]
 
 printer = PrintGlEnums()
 printer.Print(api_list)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 14/27] glapi: gl_x86_asm.py: use a main function

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_x86_asm.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
index 86d45f2..c0c7941 100644
--- a/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/src/mapi/glapi/gen/gl_x86_asm.py
@@ -227,9 +227,13 @@ def _parser():
 return parser.parse_args()
 
 
-if __name__ == '__main__':
+def main():
 args = _parser()
 printer = PrintGenericStubs()
 
 api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 printer.Print(api)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 09/27] glapi: gl_apitemp.py: Convert to argparse instead of getopt

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_apitemp.py | 39 +++
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_apitemp.py b/src/mapi/glapi/gen/gl_apitemp.py
index 4157032..7647428 100644
--- a/src/mapi/glapi/gen/gl_apitemp.py
+++ b/src/mapi/glapi/gen/gl_apitemp.py
@@ -25,9 +25,10 @@
 # Authors:
 #Ian Romanick 
 
+import argparse
+
 import gl_XML, glX_XML
 import license
-import sys, getopt
 
 class PrintGlOffsets(gl_XML.gl_print_base):
 def __init__(self, es=False):
@@ -301,27 +302,25 @@ _glapi_proc UNUSED_TABLE_NAME[] = {"""
 return
 
 
-def show_usage():
-print "Usage: %s [-f input_file_name] [-c]" % sys.argv[0]
-print "-c  Enable compatibility with OpenGL ES."
-sys.exit(1)
-
-if __name__ == '__main__':
-file_name = "gl_API.xml"
+def _parser():
+"""Parser arguments and return a namespace."""
+parser = argparse.ArgumentParser()
+parser.add_argument('-f',
+metavar='',
+dest='filename',
+default="gl_API.xml",
+help="An XML file describing the API.")
+parser.add_argument('-c',
+action='store_true',
+dest='es',
+help="Enable OpenGL ES compatibility")
+return parser.parse_args()
 
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "f:c")
-except Exception,e:
-show_usage()
 
-es = False
-for (arg,val) in args:
-if arg == "-f":
-file_name = val
-elif arg == "-c":
-es = True
+if __name__ == '__main__':
+args = _parser()
 
-api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 
-printer = PrintGlOffsets(es)
+printer = PrintGlOffsets(args.es)
 printer.Print(api)
-- 
2.4.1

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


[Mesa-dev] [PATCH 06/27] glapi: gl_procs.py: Use argparse rather than getopt

2015-05-20 Thread Dylan Baker
From: Dylan Baker 

Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_procs.py | 42 +++---
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_procs.py b/src/mapi/glapi/gen/gl_procs.py
index d5ffb92..cf6d2de 100644
--- a/src/mapi/glapi/gen/gl_procs.py
+++ b/src/mapi/glapi/gen/gl_procs.py
@@ -25,8 +25,7 @@
 # Authors:
 #Ian Romanick 
 
-import sys
-import getopt
+import argparse
 
 import license
 import gl_XML
@@ -164,31 +163,28 @@ typedef struct {
 return
 
 
-def show_usage():
-print "Usage: %s [-f input_file_name] [-c]" % sys.argv[0]
-print "-c  Enable compatibility with OpenGL ES."
-sys.exit(1)
+def _parser():
+"""Parse arguments and return a namepsace."""
+api_type = lambda x: gl_XML.parse_GL_API(x, glX_XML.glx_item_factory())
+
+parser = argparse.ArgumentParser()
+parser.add_argument('-f', '--filename',
+type=api_type,
+default='gl_API.xml',
+metavar="input_file_name",
+dest='api',
+help="Path to an XML description of OpenGL API.")
+parser.add_argument('-c', '--es-version',
+dest='es',
+action="store_true",
+help="filter functions for es")
+return parser.parse_args()
 
 
 def main():
 """Main function."""
-file_name = "gl_API.xml"
-
-try:
-args, _ = getopt.getopt(sys.argv[1:], "f:c")
-except Exception:
-show_usage()
-
-es = False
-for arg, val in args:
-if arg == "-f":
-file_name = val
-elif arg == "-c":
-es = True
-
-api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
-printer = PrintGlProcs(es)
-printer.Print(api)
+args = _parser()
+PrintGlProcs(args.es).Print(args.api)
 
 
 if __name__ == '__main__':
-- 
2.4.1

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


[Mesa-dev] [PATCH 13/27] glapi: gl_x86_asm.py: use argparse instead of getopt

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_x86_asm.py | 39 ++-
 1 file changed, 14 insertions(+), 25 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
index f855dba..86d45f2 100644
--- a/src/mapi/glapi/gen/gl_x86_asm.py
+++ b/src/mapi/glapi/gen/gl_x86_asm.py
@@ -25,9 +25,10 @@
 # Authors:
 #Ian Romanick 
 
+import argparse
+
 import license
 import gl_XML, glX_XML
-import sys, getopt
 
 class PrintGenericStubs(gl_XML.gl_print_base):
 
@@ -217,30 +218,18 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 
 return
 
-def show_usage():
-print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
-sys.exit(1)
+def _parser():
+parser = argparse.ArgumentParser()
+parser.add_argument('-f',
+dest='filename',
+default='gl_API.xml',
+help='An XML file describing an API.')
+return parser.parse_args()
+
 
 if __name__ == '__main__':
-file_name = "gl_API.xml"
-mode = "generic"
-
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
-except Exception,e:
-show_usage()
-
-for (arg,val) in args:
-if arg == '-m':
-mode = val
-elif arg == "-f":
-file_name = val
-
-if mode == "generic":
-printer = PrintGenericStubs()
-else:
-print "ERROR: Invalid mode \"%s\" specified." % mode
-show_usage()
-
-api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+args = _parser()
+printer = PrintGenericStubs()
+
+api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 printer.Print(api)
-- 
2.4.1

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


[Mesa-dev] [PATCH 24/27] glapi: glX_proto_recv.py: use argparse instead of getopt

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/glX_proto_recv.py | 55 
 1 file changed, 30 insertions(+), 25 deletions(-)

diff --git a/src/mapi/glapi/gen/glX_proto_recv.py 
b/src/mapi/glapi/gen/glX_proto_recv.py
index d076409..dbc26a8 100644
--- a/src/mapi/glapi/gen/glX_proto_recv.py
+++ b/src/mapi/glapi/gen/glX_proto_recv.py
@@ -25,8 +25,10 @@
 # Authors:
 #Ian Romanick 
 
+import argparse
+import string
+
 import gl_XML, glX_XML, glX_proto_common, license
-import sys, getopt, string
 
 
 class PrintGlxDispatch_h(gl_XML.gl_print_base):
@@ -524,31 +526,34 @@ class 
PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
 return
 
 
+def _parser():
+"""Parse any arguments passed and return a namespace."""
+parser = argparse.ArgumentParser()
+parser.add_argument('-f',
+dest='filename',
+default='gl_API.xml',
+help='an xml file describing an OpenGL API')
+parser.add_argument('-m',
+dest='mode',
+default='dispatch_c',
+choices=['dispatch_c', 'dispatch_h'],
+help='what file to generate')
+parser.add_argument('-s',
+dest='swap',
+action='store_true',
+help='emit swap in GlXDispatchFunctions')
+return parser.parse_args()
+
+
 if __name__ == '__main__':
-file_name = "gl_API.xml"
-
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "f:m:s")
-except Exception,e:
-show_usage()
-
-mode = "dispatch_c"
-do_swap = 0
-for (arg,val) in args:
-if arg == "-f":
-file_name = val
-elif arg == "-m":
-mode = val
-elif arg == "-s":
-do_swap = 1
-
-if mode == "dispatch_c":
-printer = PrintGlxDispatchFunctions(do_swap)
-elif mode == "dispatch_h":
+args = _parser()
+
+if args._mode == "dispatch_c":
+printer = PrintGlxDispatchFunctions(args.swap)
+elif args._mode == "dispatch_h":
 printer = PrintGlxDispatch_h()
-else:
-show_usage()
 
-api = gl_XML.parse_GL_API( file_name, 
glX_proto_common.glx_proto_item_factory() )
+api = gl_XML.parse_GL_API(
+args.filename, glX_proto_common.glx_proto_item_factory())
 
-printer.Print( api )
+printer.Print(api)
-- 
2.4.1

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


[Mesa-dev] [PATCH 16/27] glapi: gl_x86-64_asm.py: Use a main function

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_x86-64_asm.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py 
b/src/mapi/glapi/gen/gl_x86-64_asm.py
index 0188964..cf42371 100644
--- a/src/mapi/glapi/gen/gl_x86-64_asm.py
+++ b/src/mapi/glapi/gen/gl_x86-64_asm.py
@@ -302,9 +302,14 @@ def _parser():
 return parser.parse_args()
 
 
-if __name__ == '__main__':
+def main():
+"""Main file."""
 args = _parser()
 printer = PrintGenericStubs()
 api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 
 printer.Print(api)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 25/27] glapi: glX_proto_recv.py: Use a main function

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/glX_proto_recv.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/glX_proto_recv.py 
b/src/mapi/glapi/gen/glX_proto_recv.py
index dbc26a8..da468dc 100644
--- a/src/mapi/glapi/gen/glX_proto_recv.py
+++ b/src/mapi/glapi/gen/glX_proto_recv.py
@@ -545,7 +545,8 @@ def _parser():
 return parser.parse_args()
 
 
-if __name__ == '__main__':
+def main():
+"""Main function."""
 args = _parser()
 
 if args._mode == "dispatch_c":
@@ -557,3 +558,7 @@ if __name__ == '__main__':
 args.filename, glX_proto_common.glx_proto_item_factory())
 
 printer.Print(api)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 23/27] glapy: gl_genexec.py: use a main function

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_genexec.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index dbaafa7..0d58a8a 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -218,8 +218,13 @@ def _parser():
 return parser.parse_args()
 
 
-if __name__ == '__main__':
+def main():
+"""Main function."""
 args = _parser()
 printer = PrintCode()
 api = gl_XML.parse_GL_API(args.filename)
 printer.Print(api)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 21/27] glapi: glX_proto_send.py: use a main function.

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/glX_proto_send.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/glX_proto_send.py 
b/src/mapi/glapi/gen/glX_proto_send.py
index ea766af..2b33030 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -1107,7 +1107,8 @@ def _parser():
 return parser.parse_args()
 
 
-if __name__ == '__main__':
+def main():
+"""Main function."""
 args = _parser()
 
 if args.mode == "proto":
@@ -1121,3 +1122,7 @@ if __name__ == '__main__':
 api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 
 printer.Print( api )
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 20/27] glapi: glX_proto_send.py: use argparse instead of getopt

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/glX_proto_send.py | 59 +---
 1 file changed, 28 insertions(+), 31 deletions(-)

diff --git a/src/mapi/glapi/gen/glX_proto_send.py 
b/src/mapi/glapi/gen/glX_proto_send.py
index b93989f..ea766af 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -2,6 +2,7 @@
 
 # (C) Copyright IBM Corporation 2004, 2005
 # All Rights Reserved.
+# Copyright (c) 2015 Intel Corporation
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the "Software"),
@@ -26,8 +27,10 @@
 #Ian Romanick 
 #Jeremy Kolb 
 
+import argparse
+
 import gl_XML, glX_XML, glX_proto_common, license
-import sys, getopt, copy, string
+import copy, string
 
 def convertStringForXCB(str):
 tmp = ""
@@ -1085,42 +1088,36 @@ extern _X_HIDDEN NOINLINE FASTCALL GLubyte * 
__glXSetupVendorRequest(
 print '#endif'
 
 
-def show_usage():
-print "Usage: %s [-f input_file_name] [-m output_mode] [-d]" % sys.argv[0]
-print "-m output_mode   Output mode can be one of 'proto', 'init_c' or 
'init_h'."
-print "-d   Enable extra debug information in the 
generated code."
-sys.exit(1)
+def _parser():
+"""Parse input and returned a parsed namespace."""
+parser = argparse.ArgumentParser()
+parser.add_argument('-f',
+default='gl_API.xml',
+dest='filename',
+help='An XML file describing an API')
+parser.add_argument('-m',
+required=True,
+dest='mode',
+choices=frozenset(['proto', 'init_c', 'init_h']),
+help='which file to generate')
+parser.add_argument('-d',
+action='store_true',
+dest='debug',
+help='turn debug mode on.')
+return parser.parse_args()
 
 
 if __name__ == '__main__':
-file_name = "gl_API.xml"
-
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "f:m:d")
-except Exception,e:
-show_usage()
-
-debug = 0
-mode = "proto"
-for (arg,val) in args:
-if arg == "-f":
-file_name = val
-elif arg == "-m":
-mode = val
-elif arg == "-d":
-debug = 1
-
-if mode == "proto":
+args = _parser()
+
+if args.mode == "proto":
 printer = PrintGlxProtoStubs()
-elif mode == "init_c":
+elif args.mode == "init_c":
 printer = PrintGlxProtoInit_c()
-elif mode == "init_h":
+elif args.mode == "init_h":
 printer = PrintGlxProtoInit_h()
-else:
-show_usage()
-
 
-printer.debug = debug
-api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() )
+printer.debug = args.debug
+api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 
 printer.Print( api )
-- 
2.4.1

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


[Mesa-dev] [PATCH 19/27] glapi: glX_server_table.py: use argparse instead of getopt

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/glX_server_table.py | 38 ++
 1 file changed, 15 insertions(+), 23 deletions(-)

diff --git a/src/mapi/glapi/gen/glX_server_table.py 
b/src/mapi/glapi/gen/glX_server_table.py
index 47aa111..2d21f4e 100644
--- a/src/mapi/glapi/gen/glX_server_table.py
+++ b/src/mapi/glapi/gen/glX_server_table.py
@@ -25,8 +25,9 @@
 # Authors:
 #Ian Romanick 
 
+import argparse
+
 import gl_XML, glX_XML, glX_proto_common, license
-import sys, getopt
 
 
 def log2(value):
@@ -383,28 +384,19 @@ class 
PrintGlxDispatchTables(glX_proto_common.glx_print_proto):
 return
 
 
-if __name__ == '__main__':
-file_name = "gl_API.xml"
-
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "f:m")
-except Exception,e:
-show_usage()
-
-mode = "table_c"
-for (arg,val) in args:
-if arg == "-f":
-file_name = val
-elif arg == "-m":
-mode = val
+def _parser():
+"""Parse arguments and return namespace."""
+parser = argparse.ArgumentParser()
+parser.add_argument('-f',
+dest='filename',
+default='gl_API.xml',
+help='An XML file describing an API.')
+return parser.parse_args()
 
-if mode == "table_c":
-printer = PrintGlxDispatchTables()
-else:
-show_usage()
-
-
-api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() )
 
+if __name__ == '__main__':
+args = _parser()
+printer = PrintGlxDispatchTables()
+api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 
-printer.Print( api )
+printer.Print(api)
-- 
2.4.1

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


[Mesa-dev] [PATCH 22/27] glapi: gl_genexec.py: use argparse instead of getopt

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_genexec.py | 29 -
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index 4e76fe3..dbaafa7 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -25,10 +25,11 @@
 # _mesa_initialize_exec_table().  It is responsible for populating all
 # entries in the "exec" dispatch table that aren't dynamic.
 
+import argparse
 import collections
 import license
 import gl_XML
-import sys, getopt
+import sys
 
 
 exec_flavor_map = {
@@ -207,24 +208,18 @@ class PrintCode(gl_XML.gl_print_base):
 print '   }'
 
 
-def show_usage():
-print "Usage: %s [-f input_file_name]" % sys.argv[0]
-sys.exit(1)
+def _parser():
+"""Parse arguments and return namespace."""
+parser = argparse.ArgumentParser()
+parser.add_argument('-f',
+dest='filename',
+default='gl_and_es_API.xml',
+help='an xml file describing an API')
+return parser.parse_args()
 
 
 if __name__ == '__main__':
-file_name = "gl_and_es_API.xml"
-
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
-except Exception,e:
-show_usage()
-
-for (arg,val) in args:
-if arg == "-f":
-file_name = val
-
+args = _parser()
 printer = PrintCode()
-
-api = gl_XML.parse_GL_API(file_name)
+api = gl_XML.parse_GL_API(args.filename)
 printer.Print(api)
-- 
2.4.1

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


[Mesa-dev] [PATCH 18/27] glapi: gl_SPARC_asm.py: use main function

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_SPARC_asm.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_SPARC_asm.py 
b/src/mapi/glapi/gen/gl_SPARC_asm.py
index df7a039..fa6217e 100644
--- a/src/mapi/glapi/gen/gl_SPARC_asm.py
+++ b/src/mapi/glapi/gen/gl_SPARC_asm.py
@@ -255,9 +255,14 @@ def _parser():
 return parser.parse_args()
 
 
-if __name__ == '__main__':
+def main():
+"""Main function."""
 args = _parser()
 printer = PrintGenericStubs()
 
 api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 printer.Print(api)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 27/27] glapi: glX_proto_size.py: use a main function

2015-05-20 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/glX_proto_size.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/glX_proto_size.py 
b/src/mapi/glapi/gen/glX_proto_size.py
index 59f65d4..75fc26f 100644
--- a/src/mapi/glapi/gen/glX_proto_size.py
+++ b/src/mapi/glapi/gen/glX_proto_size.py
@@ -684,7 +684,8 @@ def _parser():
 return parser.parse_args()
 
 
-if __name__ == '__main__':
+def main():
+"""Main function."""
 args = _parser()
 
 if args.mode == "size_c":
@@ -701,3 +702,7 @@ if __name__ == '__main__':
 api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 
 printer.Print(api)
+
+
+if __name__ == '__main__':
+main()
-- 
2.4.1

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


[Mesa-dev] [PATCH 26/27] glapi: glX_proto_size.py: use argparse instead of getopt

2015-05-20 Thread Dylan Baker
This is roughly equivalent to the original getopt, except that it
removes the '-h' short option, which argparse reserves for
auto-generated help messages. It does retain the long option specified
by the getopt version, and changes the makefile to use that.

Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/Makefile.am   |  2 +-
 src/mapi/glapi/gen/glX_proto_size.py | 90 ++--
 2 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index adebd5c..d7742f7 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -290,7 +290,7 @@ $(MESA_GLX_DIR)/indirect_init.c: glX_proto_send.py 
$(COMMON_GLX)
 
 $(MESA_GLX_DIR)/indirect_size.h $(XORG_GLX_DIR)/indirect_size.h: 
glX_proto_size.py $(COMMON_GLX)
$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m size_h --only-set \
-   -h _INDIRECT_SIZE_H_ \
+   --header-tag _INDIRECT_SIZE_H_ \
  | $(INDENT) $(INDENT_FLAGS) > $@
 
 $(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX)
diff --git a/src/mapi/glapi/gen/glX_proto_size.py 
b/src/mapi/glapi/gen/glX_proto_size.py
index 4737fbf..59f65d4 100644
--- a/src/mapi/glapi/gen/glX_proto_size.py
+++ b/src/mapi/glapi/gen/glX_proto_size.py
@@ -25,9 +25,11 @@
 # Authors:
 #Ian Romanick 
 
+import argparse
+import sys, string
+
 import gl_XML, glX_XML
 import license
-import sys, getopt, copy, string
 
 
 class glx_enum_function(object):
@@ -650,54 +652,52 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
 return alias
 
 
-def show_usage():
-print "Usage: %s [-f input_file_name] -m output_mode [--only-get | 
--only-set] [--get-alias-set]" % sys.argv[0]
-print "-m output_mode   Output mode can be one of 'size_c' or 
'size_h'."
-print "--only-get   Only emit 'get'-type functions."
-print "--only-set   Only emit 'set'-type functions."
-print ""
-print "By default, both 'get' and 'set'-type functions are emitted."
-sys.exit(1)
+def _parser():
+"""Parse arguments and return a namespace."""
+parser = argparse.ArgumentParser()
+parser.set_defaults(which_functions=(PrintGlxSizeStubs_common.do_get |
+ PrintGlxSizeStubs_common.do_set))
+parser.add_argument('-f',
+dest='filename',
+default='gl_API.xml',
+help='an XML file describing an OpenGL API.')
+parser.add_argument('-m',
+dest='mode',
+choices=['size_c', 'size_h', 'reqsize_c', 'reqsize_h'],
+help='Which file to generate')
+getset = parser.add_mutually_exclusive_group()
+getset.add_argument('--only-get',
+dest='which_functions',
+action='store_const',
+const=PrintGlxSizeStubs_common.do_get,
+help='only emit "get-type" functions')
+getset.add_argument('--only-set',
+dest='which_functions',
+action='store_const',
+const=PrintGlxSizeStubs_common.do_set,
+help='only emit "set-type" functions')
+parser.add_argument('--header-tag',
+dest='header_tag',
+action='store',
+default=None,
+help='set header tag value')
+return parser.parse_args()
 
 
 if __name__ == '__main__':
-file_name = "gl_API.xml"
-
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "f:m:h:", ["only-get", 
"only-set", "header-tag"])
-except Exception,e:
-show_usage()
-
-mode = None
-header_tag = None
-which_functions = PrintGlxSizeStubs_common.do_get | 
PrintGlxSizeStubs_common.do_set
-
-for (arg,val) in args:
-if arg == "-f":
-file_name = val
-elif arg == "-m":
-mode = val
-elif arg == "--only-get":
-which_functions = PrintGlxSizeStubs_common.do_get
-elif arg == "--only-set":
-which_functions = PrintGlxSizeStubs_common.do_set
-elif (arg == '-h') or (arg == "--header-tag"):
-header_tag = val
-
-if mode == "size_c":
-printer = PrintGlxSizeStubs_c( which_functions )
-elif mode == "size_h":
-printer = PrintGlxSizeStubs_h( which_functions )
-if header_tag:
-printer.header_tag = header_tag
-elif mode == "reqsize_c":
+args = _parser()
+
+if args.mode == "size_c":
+printer = PrintGlxSizeStubs_c(args.which_functions)
+elif args.mode == "size_h":
+printer = PrintGlxSizeStubs_h(args.which_functions)
+if args.header_tag is not None:
+printer.header_tag = args.header_tag
+elif args.mode == "reqsize_c":
 printer = PrintGlxReqSize_c()
-elif mode == "reqsize_h

[Mesa-dev] [PATCH 15/27] glapi: gl_x86_64_asm.py: Use argparse instead of getopt

2015-05-20 Thread Dylan Baker
Also removes the redundant -m argument, which could only be set to
'generic', or it would raise an exception. This option wasn't used in
the make file.

Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_x86-64_asm.py | 40 +++--
 1 file changed, 16 insertions(+), 24 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py 
b/src/mapi/glapi/gen/gl_x86-64_asm.py
index 7afc2b1..0188964 100644
--- a/src/mapi/glapi/gen/gl_x86-64_asm.py
+++ b/src/mapi/glapi/gen/gl_x86-64_asm.py
@@ -25,9 +25,11 @@
 # Authors:
 #Ian Romanick 
 
+import argparse
+import copy
+
 import license
 import gl_XML, glX_XML
-import sys, getopt, copy
 
 def should_use_push(registers):
 for [reg, offset] in registers:
@@ -289,30 +291,20 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 
 return
 
-def show_usage():
-print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
-sys.exit(1)
+
+def _parser():
+"""Parse arguments and return a namespace."""
+parser = argparse.ArgumentParser()
+parser.add_argument('-f',
+default='gl_API.xml',
+dest='filename',
+help='An XML file describing an API')
+return parser.parse_args()
+
 
 if __name__ == '__main__':
-file_name = "gl_API.xml"
-mode = "generic"
-
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
-except Exception,e:
-show_usage()
-
-for (arg,val) in args:
-if arg == '-m':
-mode = val
-elif arg == "-f":
-file_name = val
-
-if mode == "generic":
-printer = PrintGenericStubs()
-else:
-print "ERROR: Invalid mode \"%s\" specified." % mode
-show_usage()
+args = _parser()
+printer = PrintGenericStubs()
+api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 
-api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
 printer.Print(api)
-- 
2.4.1

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


[Mesa-dev] [PATCH 17/27] glapi: gl_SPARC_asm.py use argparse instead of getopt

2015-05-20 Thread Dylan Baker
Also drop -m switch, which only accepted a single value or raised an
error, and was unused in the makefile.

Signed-off-by: Dylan Baker 
---
 src/mapi/glapi/gen/gl_SPARC_asm.py | 38 ++
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_SPARC_asm.py 
b/src/mapi/glapi/gen/gl_SPARC_asm.py
index 23e2329..df7a039 100644
--- a/src/mapi/glapi/gen/gl_SPARC_asm.py
+++ b/src/mapi/glapi/gen/gl_SPARC_asm.py
@@ -25,9 +25,10 @@
 # Authors:
 #Ian Romanick 
 
+import argparse
+
 import license
 import gl_XML, glX_XML
-import sys, getopt
 
 class PrintGenericStubs(gl_XML.gl_print_base):
 def __init__(self):
@@ -244,30 +245,19 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 return
 
 
-def show_usage():
-print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
-sys.exit(1)
-
-if __name__ == '__main__':
-file_name = "gl_API.xml"
-mode = "generic"
+def _parser():
+"""Parse arguments and return a namespace."""
+parser = argparse.ArgumentParser()
+parser.add_argument('-f',
+dest='filename',
+default='gl_API.xml',
+help='An XML description of an API.')
+return parser.parse_args()
 
-try:
-(args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
-except Exception,e:
-show_usage()
 
-for (arg,val) in args:
-if arg == '-m':
-mode = val
-elif arg == "-f":
-file_name = val
-
-if mode == "generic":
-printer = PrintGenericStubs()
-else:
-print "ERROR: Invalid mode \"%s\" specified." % mode
-show_usage()
+if __name__ == '__main__':
+args = _parser()
+printer = PrintGenericStubs()
 
-api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
 printer.Print(api)
-- 
2.4.1

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


[Mesa-dev] [PATCH 13/15 v2] mesa: Use the profile instead of an extension bit to validate GL_TEXTURE_CUBE_MAP

2015-05-20 Thread Ian Romanick
From: Ian Romanick 

The extension on which this depends will always be enabled in core
profile, and the extension bit is about to be removed.

Signed-off-by: Ian Romanick 
Cc: "10.6" 
Cc: Fredrik Höglund 
---
 src/mesa/main/fbobject.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 5b8c52a..c5a7026 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2707,6 +2707,10 @@ check_texture_target(struct gl_context *ctx, GLenum 
target,
/* We're being called by glFramebufferTextureLayer().
 * The only legal texture types for that function are 3D,
 * cube-map, and 1D/2D/cube-map array textures.
+*
+* We don't need to check for GL_ARB_texture_cube_map_array because the
+* application wouldn't have been able to create a texture with a
+* GL_TEXTURE_CUBE_MAP_ARRAY target if the extension were not enabled.
 */
switch (target) {
case GL_TEXTURE_3D:
@@ -2716,10 +2720,13 @@ check_texture_target(struct gl_context *ctx, GLenum 
target,
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
   return true;
case GL_TEXTURE_CUBE_MAP:
-  /* This target is valid in TextureLayer when ARB_direct_state_access
-   * or OpenGL 4.5 is supported.
+  /* We don't need to check the extension (GL_ARB_direct_state_access) or
+   * GL version (4.5) for GL_TEXTURE_CUBE_MAP because DSA is always
+   * enabled in core profile.  This can be called from
+   * _mesa_FramebufferTextureLayer in compatibility profile (OpenGL 3.0),
+   * so we do have to check the profile.
*/
-  return ctx->Extensions.ARB_direct_state_access;
+  return ctx->API == API_OPENGL_CORE;
}
 
_mesa_error(ctx, GL_INVALID_OPERATION,
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH 05/27] glapi: gl_procs.py: Fix a few long hanging style things

2015-05-20 Thread Matt Turner
> glapi: gl_procs.py: Fix a few long hanging style things

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


Re: [Mesa-dev] [PATCH 11/27] glapi: gl_gentable.py: Replace getopt with argparse

2015-05-20 Thread Matt Turner
On Wed, May 20, 2015 at 6:03 PM, Dylan Baker  wrote:
> Signed-off-by: Dylan Baker 
> ---
>  src/mapi/glapi/gen/gl_gentable.py | 29 +++--
>  1 file changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/src/mapi/glapi/gen/gl_gentable.py 
> b/src/mapi/glapi/gen/gl_gentable.py
> index 06a5ebf..f7ffaf0 100644
> --- a/src/mapi/glapi/gen/gl_gentable.py
> +++ b/src/mapi/glapi/gen/gl_gentable.py
> @@ -2,6 +2,7 @@
>
>  # (C) Copyright IBM Corporation 2004, 2005
>  # (C) Copyright Apple Inc. 2011
> +# Copyright (C) 2015 Itnel Corporation

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


Re: [Mesa-dev] glapi: use only one kind of argument parser in python generators

2015-05-20 Thread Matt Turner
I breezed through the series and pointed out a couple of typos, but it
all looks fine to me. Nice clean ups.

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


[Mesa-dev] [PATCH] u_math: uses assert, include assert.h

2015-05-20 Thread Dave Airlie
From: Dave Airlie 

this fixes a build problem found on RHEL s390.

not sure what configure options caused it, I couldn't get it on
x86 here.

Cc: "10.6" mesa-sta...@lists.freedesktop.org
Signed-off-by: Dave Airlie 
---
 src/gallium/auxiliary/util/u_math.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/auxiliary/util/u_math.h 
b/src/gallium/auxiliary/util/u_math.h
index 3d27a59..58070a9 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -42,6 +42,7 @@
 #include "pipe/p_compiler.h"
 
 #include "c99_math.h"
+#include 
 #include 
 #include 
 
-- 
1.9.3

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


Re: [Mesa-dev] [PATCH v2 12/15] nv50/ir: optimize the use of std::tr1::unordered_set

2015-05-20 Thread Chih-Wei Huang
2015-05-20 16:35 GMT+08:00 Petri Latvala :
> On 05/20/2015 06:30 AM, Ilia Mirkin wrote:
>>
>> +typedef const iterator const_iterator;
>> +
>
> This at least is wrong. A const iterator allows *iter = val, a
> const_iterator doesn't. A const_iterator allows ++, a const iterator
> doesn't.

You're right. Thank you!
The const_iterator should be derived from _base::const_iterator.

After review the code again, the unordered_set::const_iterator is not
used except in Value::UseCIterator, but the latter is not used, either.
So I think it's safe to remove it at all.


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


[Mesa-dev] [PATCH] i965: Emit 3DSTATE_MULTISAMPLE before WM_HZ_OP (gen8+)

2015-05-20 Thread Ben Widawsky
Starting with GEN8, there is documentation that the multisample state command
must be emitted before the 3DSTATE_WM_HZ_OP command any time the multisample
count changes. The 3DSTATE_WM_HZ_OP packet gets emitted as a result of a
intel_hix_exec(), which is called upon a fast clear and/or a resolve. This can
happen before the state atoms are checked, and so the multisample state must be
put directly in the function.

v1:
- In v0, I was always emitting the command, but Ken came up with the condition 
to
determine whether or not the sample count actually changed.
- Ken's recommendation was to set brw->num_multisamples after emitting
3DSTATE_MULTISAMPLE. This doesn't work. I put my best guess as to why in the XXX
(it was causing 7 regressions on BDW).

Jenkins results:
http://otc-mesa-ci.jf.intel.com/view/dev/job/bwidawsk/136/

Fixes around 200 piglit tests on SKL. I'm somewhat surprised that it seems to
have no impact on BDW as the restriction is needed there as well.

Cc: mesa-sta...@lists.freedesktop.org
Cc: Anuj Phogat 
Cc: Kenneth Graunke 
Signed-off-by: Ben Widawsky 
Reviewed-by: Neil Roberts 
---
 src/mesa/drivers/dri/i965/gen8_depth_state.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/gen8_depth_state.c 
b/src/mesa/drivers/dri/i965/gen8_depth_state.c
index b502650..4888dad 100644
--- a/src/mesa/drivers/dri/i965/gen8_depth_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_depth_state.c
@@ -417,6 +417,18 @@ gen8_hiz_exec(struct brw_context *brw, struct 
intel_mipmap_tree *mt,
uint32_t surface_width  = ALIGN(mt->logical_width0,  level == 0 ? 8 : 1);
uint32_t surface_height = ALIGN(mt->logical_height0, level == 0 ? 4 : 1);
 
+   /* From the documentation for 3DSTATE_WM_HZ_OP: "3DSTATE_MULTISAMPLE packet
+* must be used prior to this packet to change the Number of Multisamples.
+* This packet must not be used to change Number of Multisamples in a
+* rendering sequence."
+*
+* XXX: It's temping to set brw->num_samples at this point but we cannot as
+* there may be functions later in the state setup which needs to know of 
the
+* change (intel_miptree_match_image).
+*/
+   if (brw->num_samples != mt->num_samples)
+  gen8_emit_3dstate_multisample(brw, mt->num_samples);
+
/* The basic algorithm is:
 * - If needed, emit 3DSTATE_{DEPTH,HIER_DEPTH,STENCIL}_BUFFER and
 *   3DSTATE_CLEAR_PARAMS packets to set up the relevant buffers.
-- 
2.4.1

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


Re: [Mesa-dev] [Mesa-stable] [PATCH 14.1/15] glapi: Store exec table version info outside the XML

2015-05-20 Thread Ian Romanick
On 05/19/2015 07:29 PM, Ilia Mirkin wrote:
> On Tue, May 19, 2015 at 3:54 PM, Ian Romanick  wrote:
>> From: Ian Romanick 
>>
>> Currently on the functions that are exclusive to core-profile are
>> implemented.  The remainder continue to live in the XML.  Additional
>> functions can be moved later.
>>
>> The functions for GL_ARB_draw_indirect and GL_ARB_multi_draw_indirect
>> are put in the dispatch table inside the VBO module, so they do not need
>> to be moved over.
>>
>> The diff of src/mesa/main/api_exec.c before and after this patch is as
>> expected.  All of the functions listed in apiexec.py moved out of a 'if
>> (_mesa_is_desktop(ctx))' block into a new 'if (ctx->API ==
>> API_OPENGL_CORE)' block.
>>
>> Signed-off-by: Ian Romanick 
>> Cc: Dave Airlie 
>> Cc: Ilia Mirkin 
>> Cc: Dylan Baker 
>> Cc: "10.6" 
>> ---
>>  src/mapi/glapi/gen/Makefile.am   |   3 +-
>>  src/mapi/glapi/gen/apiexec.py| 142 
>> +++
>>  src/mapi/glapi/gen/gl_genexec.py |  54 ---
>>  3 files changed, 187 insertions(+), 12 deletions(-)
>>  create mode 100644 src/mapi/glapi/gen/apiexec.py
>>
>> diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
>> index adebd5c..64bc2ff 100644
>> --- a/src/mapi/glapi/gen/Makefile.am
>> +++ b/src/mapi/glapi/gen/Makefile.am
>> @@ -61,6 +61,7 @@ EXTRA_DIST= \
>> $(MESA_GLAPI_DIR)/glapi_x86-64.S \
>> $(MESA_GLAPI_DIR)/glapi_sparc.S \
>> $(COMMON_GLX) \
>> +   apiexec.py \
>> gl_apitemp.py \
>> gl_enums.py \
>> gl_genexec.py \
>> @@ -267,7 +268,7 @@ $(MESA_GLAPI_DIR)/glapi_sparc.S: gl_SPARC_asm.py 
>> $(COMMON)
>>  $(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON)
>> $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@
>>
>> -$(MESA_DIR)/main/api_exec.c: gl_genexec.py $(COMMON)
>> +$(MESA_DIR)/main/api_exec.c: gl_genexec.py apiexec.py $(COMMON)
>> $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@
>>
>>  $(MESA_DIR)/main/dispatch.h: gl_table.py $(COMMON)
>> diff --git a/src/mapi/glapi/gen/apiexec.py b/src/mapi/glapi/gen/apiexec.py
>> new file mode 100644
>> index 000..1a9f042
>> --- /dev/null
>> +++ b/src/mapi/glapi/gen/apiexec.py
>> @@ -0,0 +1,142 @@
>> +#!/usr/bin/env python2
> 
> I wouldn't put that line there (or make the file +x, which you didn't
> as well). It's not an executable script.
> 
>> +
>> +# Copyright (C) 2015 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.
>> +
>> +class exec_info():
>> +"""Information relating GL APIs to a function.
>> +
>> +Each of the four attributes of this class, compatibility, core, es1, and
>> +es2, specify the minimum API version where a function can possibly exist
>> +in Mesa.  The version is specified as an integer of (real GL version *
>> +10).  For example, glCreateProgram was added in OpenGL 2.0, so
>> +compatibility=20 and core=31.
>> +
>> +If the attribute is None, then it cannot be supported by that
>> +API.  For example, glNewList was removed from core profiles, so
>> +compatibility=10 and core=None.
>> +
>> +Each of the attributes that is not None must have a valid value.  The
>> +valid ranges are:
>> +
>> +compatiblity: [10, 30]
>> +core: [31, )
>> +es1: [10, 11]
>> +es2: [20, )
>> +
>> +These ranges are enforced by the constructor.
> 
> No harm in doing this, but in practice, only the es2 version is used
> for anything, right?

For now.  There are quite a few functions that are only added by a GL
version that currently either incorrectly don't check the version (e.g.,
everything in src/mesa/main/shaderapi.c) or have spurious checks that
could be removed.

>> +"""
>> +def __init__(self, compatibility=None, core=None, es1=None, es2=None):
>> +if compatibility is not None:
>> +asse

[Mesa-dev] [PATCH 14.5/15] dispatch_sanity: Validate the compatibility profile dispatch table too

2015-05-20 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
Cc: Ilia Mirkin 
Cc: "10.6" 
---
 src/mesa/main/tests/dispatch_sanity.cpp | 493 
 1 file changed, 493 insertions(+)

diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index e67a1fd..8452364 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -69,6 +69,7 @@ struct function {
 };
 
 extern const struct function common_desktop_functions_possible[];
+extern const struct function gl_compatibility_functions_possible[];
 extern const struct function gl_core_functions_possible[];
 extern const struct function gles11_functions_possible[];
 extern const struct function gles2_functions_possible[];
@@ -182,6 +183,14 @@ TEST_F(DispatchSanity_test, GL31_CORE)
validate_nops(&ctx, nop_table);
 }
 
+TEST_F(DispatchSanity_test, GL30)
+{
+   SetUpCtx(API_OPENGL_COMPAT, 30);
+   validate_functions(&ctx, common_desktop_functions_possible, nop_table);
+   validate_functions(&ctx, gl_compatibility_functions_possible, nop_table);
+   validate_nops(&ctx, nop_table);
+}
+
 TEST_F(DispatchSanity_test, GLES11)
 {
SetUpCtx(API_OPENGLES, 11);
@@ -924,6 +933,490 @@ const struct function common_desktop_functions_possible[] 
= {
{ NULL, 0, -1 }
 };
 
+const struct function gl_compatibility_functions_possible[] = {
+   { "glBindVertexArrayAPPLE", 10, -1 },
+   { "glGenVertexArraysAPPLE", 10, -1 },
+   { "glBindRenderbufferEXT", 10, -1 },
+   { "glBindFramebufferEXT", 10, -1 },
+   { "glNewList", 10, _gloffset_NewList },
+   { "glEndList", 10, _gloffset_EndList },
+   { "glCallList", 10, _gloffset_CallList },
+   { "glCallLists", 10, _gloffset_CallLists },
+   { "glDeleteLists", 10, _gloffset_DeleteLists },
+   { "glGenLists", 10, _gloffset_GenLists },
+   { "glListBase", 10, _gloffset_ListBase },
+   { "glBegin", 10, _gloffset_Begin },
+   { "glBitmap", 10, _gloffset_Bitmap },
+   { "glColor3b", 10, _gloffset_Color3b },
+   { "glColor3bv", 10, _gloffset_Color3bv },
+   { "glColor3d", 10, _gloffset_Color3d },
+   { "glColor3dv", 10, _gloffset_Color3dv },
+   { "glColor3f", 10, _gloffset_Color3f },
+   { "glColor3fv", 10, _gloffset_Color3fv },
+   { "glColor3i", 10, _gloffset_Color3i },
+   { "glColor3iv", 10, _gloffset_Color3iv },
+   { "glColor3s", 10, _gloffset_Color3s },
+   { "glColor3sv", 10, _gloffset_Color3sv },
+   { "glColor3ub", 10, _gloffset_Color3ub },
+   { "glColor3ubv", 10, _gloffset_Color3ubv },
+   { "glColor3ui", 10, _gloffset_Color3ui },
+   { "glColor3uiv", 10, _gloffset_Color3uiv },
+   { "glColor3us", 10, _gloffset_Color3us },
+   { "glColor3usv", 10, _gloffset_Color3usv },
+   { "glColor4b", 10, _gloffset_Color4b },
+   { "glColor4bv", 10, _gloffset_Color4bv },
+   { "glColor4d", 10, _gloffset_Color4d },
+   { "glColor4dv", 10, _gloffset_Color4dv },
+   { "glColor4f", 10, _gloffset_Color4f },
+   { "glColor4fv", 10, _gloffset_Color4fv },
+   { "glColor4i", 10, _gloffset_Color4i },
+   { "glColor4iv", 10, _gloffset_Color4iv },
+   { "glColor4s", 10, _gloffset_Color4s },
+   { "glColor4sv", 10, _gloffset_Color4sv },
+   { "glColor4ub", 10, _gloffset_Color4ub },
+   { "glColor4ubv", 10, _gloffset_Color4ubv },
+   { "glColor4ui", 10, _gloffset_Color4ui },
+   { "glColor4uiv", 10, _gloffset_Color4uiv },
+   { "glColor4us", 10, _gloffset_Color4us },
+   { "glColor4usv", 10, _gloffset_Color4usv },
+   { "glEdgeFlag", 10, _gloffset_EdgeFlag },
+   { "glEdgeFlagv", 10, _gloffset_EdgeFlagv },
+   { "glEnd", 10, _gloffset_End },
+   { "glIndexd", 10, _gloffset_Indexd },
+   { "glIndexdv", 10, _gloffset_Indexdv },
+   { "glIndexf", 10, _gloffset_Indexf },
+   { "glIndexfv", 10, _gloffset_Indexfv },
+   { "glIndexi", 10, _gloffset_Indexi },
+   { "glIndexiv", 10, _gloffset_Indexiv },
+   { "glIndexs", 10, _gloffset_Indexs },
+   { "glIndexsv", 10, _gloffset_Indexsv },
+   { "glNormal3b", 10, _gloffset_Normal3b },
+   { "glNormal3bv", 10, _gloffset_Normal3bv },
+   { "glNormal3d", 10, _gloffset_Normal3d },
+   { "glNormal3dv", 10, _gloffset_Normal3dv },
+   { "glNormal3f", 10, _gloffset_Normal3f },
+   { "glNormal3fv", 10, _gloffset_Normal3fv },
+   { "glNormal3i", 10, _gloffset_Normal3i },
+   { "glNormal3iv", 10, _gloffset_Normal3iv },
+   { "glNormal3s", 10, _gloffset_Normal3s },
+   { "glNormal3sv", 10, _gloffset_Normal3sv },
+   { "glRasterPos2d", 10, _gloffset_RasterPos2d },
+   { "glRasterPos2dv", 10, _gloffset_RasterPos2dv },
+   { "glRasterPos2f", 10, _gloffset_RasterPos2f },
+   { "glRasterPos2fv", 10, _gloffset_RasterPos2fv },
+   { "glRasterPos2i", 10, _gloffset_RasterPos2i },
+   { "glRasterPos2iv", 10, _gloffset_RasterPos2iv },
+   { "glRasterPos2s", 10, _gloffset_RasterPos2s },
+   { "glRasterPos2sv", 10, _gloffset_RasterPos2sv },
+   { "glRasterPos3d", 10, _gloffset_RasterPos3d },
+   { "glRasterPos3dv", 10, _gloffset_RasterPos3dv },
+   { "glRasterPos3f", 10, _gloffset_RasterPos3f },
+   { "glRasterPos3fv", 10, _gloffset_RasterP

[Mesa-dev] [PATCH 14.3/15] mesa: Don't install glVertexAttribL* functions in compatibility profile

2015-05-20 Thread Ian Romanick
From: Ian Romanick 

GL_ARB_vertex_attrib_64bit is exclusive to core profile, and none of the
other functions added by the extension are advertised in other profiles.

Signed-off-by: Ian Romanick 
Cc: Dave Airlie 
Cc: Ilia Mirkin 
Cc: "10.6" 
---
 src/mesa/main/api_loopback.c | 2 ++
 src/mesa/main/vtxfmt.c   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index 9932a83..a7fd82c 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -1772,7 +1772,9 @@ _mesa_loopback_init_api_table(const struct gl_context 
*ctx,
   SET_VertexAttribI4sv(dest, _mesa_VertexAttribI4sv);
   SET_VertexAttribI4ubv(dest, _mesa_VertexAttribI4ubv);
   SET_VertexAttribI4usv(dest, _mesa_VertexAttribI4usv);
+   }
 
+   if (ctx->API == API_OPENGL_CORE) {
   /* GL 4.1 / GL_ARB_vertex_attrib_64bit */
   SET_VertexAttribL1d(dest, _mesa_VertexAttribL1d);
   SET_VertexAttribL2d(dest, _mesa_VertexAttribL2d);
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index d7ef7e2..81bf4c5 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -207,7 +207,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table 
*tab,
   SET_VertexAttribP4uiv(tab, vfmt->VertexAttribP4uiv);
}
 
-   if (_mesa_is_desktop_gl(ctx)) {
+   if (ctx->API == API_OPENGL_CORE) {
   SET_VertexAttribL1d(tab, vfmt->VertexAttribL1d);
   SET_VertexAttribL2d(tab, vfmt->VertexAttribL2d);
   SET_VertexAttribL3d(tab, vfmt->VertexAttribL3d);
-- 
2.1.0

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


[Mesa-dev] [PATCH 14.4/15] dispatch_sanity: Split list of GL 3.1 functions in to core and common

2015-05-20 Thread Ian Romanick
From: Ian Romanick 

The next patch will add a test for compatibility profile dispatch, and
it seems to make more sense to share the lists.

Signed-off-by: Ian Romanick 
Cc: Ilia Mirkin 
Cc: "10.6" 
---
 src/mesa/main/tests/dispatch_sanity.cpp | 413 ++--
 1 file changed, 342 insertions(+), 71 deletions(-)

diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index 55c3a32..e67a1fd 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -68,6 +68,7 @@ struct function {
int offset;
 };
 
+extern const struct function common_desktop_functions_possible[];
 extern const struct function gl_core_functions_possible[];
 extern const struct function gles11_functions_possible[];
 extern const struct function gles2_functions_possible[];
@@ -176,6 +177,7 @@ validate_nops(struct gl_context *ctx, const _glapi_proc 
*nop_table)
 TEST_F(DispatchSanity_test, GL31_CORE)
 {
SetUpCtx(API_OPENGL_CORE, 31);
+   validate_functions(&ctx, common_desktop_functions_possible, nop_table);
validate_functions(&ctx, gl_core_functions_possible, nop_table);
validate_nops(&ctx, nop_table);
 }
@@ -211,7 +213,7 @@ TEST_F(DispatchSanity_test, GLES31)
validate_nops(&ctx, nop_table);
 }
 
-const struct function gl_core_functions_possible[] = {
+const struct function common_desktop_functions_possible[] = {
{ "glCullFace", 10, -1 },
{ "glFrontFace", 10, -1 },
{ "glHint", 10, -1 },
@@ -223,8 +225,8 @@ const struct function gl_core_functions_possible[] = {
{ "glTexParameterfv", 10, -1 },
{ "glTexParameteri", 10, -1 },
{ "glTexParameteriv", 10, -1 },
-   { "glTexImage1D", 10, -1 },
-   { "glTexImage2D", 10, -1 },
+   { "glTexImage1D", 10, _gloffset_TexImage1D },
+   { "glTexImage2D", 10, _gloffset_TexImage2D },
{ "glDrawBuffer", 10, -1 },
{ "glClear", 10, -1 },
{ "glClearColor", 10, -1 },
@@ -492,7 +494,6 @@ const struct function gl_core_functions_possible[] = {
/* GL 3.1 */
{ "glDrawArraysInstanced", 31, -1 },
{ "glDrawElementsInstanced", 31, -1 },
-   { "glTexBuffer", 31, -1 },
{ "glPrimitiveRestartIndex", 31, -1 },
 
/* GL_ARB_shader_objects */
@@ -546,7 +547,6 @@ const struct function gl_core_functions_possible[] = {
{ "glGetBufferParameteri64v", 32, -1 },
{ "glFramebufferTexture", 32, -1 },
{ "glProgramParameteri", 32, -1 },
-   { "glFramebufferTexture", 32, -1 },
{ "glFramebufferTextureLayer", 32, -1 },
 
/* GL 3.3 */
@@ -680,34 +680,6 @@ const struct function gl_core_functions_possible[] = {
{ "glVertexAttribP4uiv", 43, -1 },
{ "glDrawArraysIndirect", 43, -1 },
{ "glDrawElementsIndirect", 43, -1 },
-   { "glUniform1d", 40, -1 },
-   { "glUniform2d", 40, -1 },
-   { "glUniform3d", 40, -1 },
-   { "glUniform4d", 40, -1 },
-   { "glUniform1dv", 40, -1 },
-   { "glUniform2dv", 40, -1 },
-   { "glUniform3dv", 40, -1 },
-   { "glUniform4dv", 40, -1 },
-   { "glUniformMatrix2dv", 40, -1 },
-   { "glUniformMatrix3dv", 40, -1 },
-   { "glUniformMatrix4dv", 40, -1 },
-   { "glUniformMatrix2x3dv", 40, -1 },
-   { "glUniformMatrix2x4dv", 40, -1 },
-   { "glUniformMatrix3x2dv", 40, -1 },
-   { "glUniformMatrix3x4dv", 40, -1 },
-   { "glUniformMatrix4x2dv", 40, -1 },
-   { "glUniformMatrix4x3dv", 40, -1 },
-   { "glGetUniformdv", 43, -1 },
-// { "glGetSubroutineUniformLocation", 43, -1 },// XXX: Add to xml
-// { "glGetSubroutineIndex", 43, -1 },  // XXX: Add to xml
-// { "glGetActiveSubroutineUniformiv", 43, -1 },// XXX: Add to xml
-// { "glGetActiveSubroutineUniformName", 43, -1 },  // XXX: Add to xml
-// { "glGetActiveSubroutineName", 43, -1 }, // XXX: Add to xml
-// { "glUniformSubroutinesuiv", 43, -1 },   // XXX: Add to xml
-// { "glGetUniformSubroutineuiv", 43, -1 }, // XXX: Add to xml
-// { "glGetProgramStageiv", 43, -1 },   // XXX: Add to xml
-// { "glPatchParameteri", 43, -1 }, // XXX: Add to xml
-// { "glPatchParameterfv", 43, -1 },// XXX: Add to xml
{ "glBindTransformFeedback", 43, -1 },
{ "glDeleteTransformFeedbacks", 43, -1 },
{ "glGenTransformFeedbacks", 43, -1 },
@@ -735,12 +707,12 @@ const struct function gl_core_functions_possible[] = {
{ "glGenProgramPipelines", 43, -1 },
{ "glIsProgramPipeline", 43, -1 },
{ "glGetProgramPipelineiv", 43, -1 },
+   { "glProgramUniform1d", 43, -1 },
+   { "glProgramUniform1dv", 43, -1 },
{ "glProgramUniform1i", 43, -1 },
{ "glProgramUniform1iv", 43, -1 },
{ "glProgramUniform1f", 43, -1 },
{ "glProgramUniform1fv", 43, -1 },
-   { "glProgramUniform1d", 40, -1 },
-   { "glProgramUniform1dv", 40, -1 },
{ "glProgramUniform1ui", 43, -1 },
{ "glProgramUniform1uiv", 43, -1 },
{ "glProgramUniform2i", 43, -1 },
@@ -761,50 +733,32 @@ const struct function gl_core_functions_possible[] = {
{ "glProgramUniform3uiv", 43, -1