[Mesa-dev] [PATCH] st/mesa: Initialize tgsi_texture_offset Padding field.

2012-08-08 Thread Vinson Lee
Fixes uninitialized scalar variable defect reported by Coverity.

Signed-off-by: Vinson Lee v...@freedesktop.org
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 43c80be..39717b6 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4178,6 +4178,7 @@ translate_tex_offset(struct st_translate *t,
offset.SwizzleX = in_offset-SwizzleX;
offset.SwizzleY = in_offset-SwizzleY;
offset.SwizzleZ = in_offset-SwizzleZ;
+   offset.Padding = 0;
 
return offset;
 }
-- 
1.7.11.1

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


Re: [Mesa-dev] [PATCH 7/7] i965: Rework the extra flushes surrounding occlusion queries.

2012-08-08 Thread Daniel Vetter
On Tue, Aug 07, 2012 at 04:05:33PM -0700, Kenneth Graunke wrote:
 Separate out the depth stall from the depth count write.  Workarounds
 say that a depth stall needs to be preceeded with a non-zero post-sync
 op (in this case, the depth count write).  Also, before the non-zero
 post-sync op, we need a CS stall, which needs a stall at scoreboard.
 
 Signed-off-by: Daniel Vetter daniel.vet...@ffwll.ch
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org

In my understanding of Bspec (haven't done any experiments on hw) we need
to set the depth stall bit on the pipe_control with the depth_count write
(bspec for both snbivb even says that depth stall should be disable if
post sync op != write_depth). So I think we need to keep these two
together and simply emit the entire nonzero postsync op workaround on
gen6, like we already do for render cache flushes.

In my reading of bspec, no such workaround is required on gen7+
-Daniel

 ---
  src/mesa/drivers/dri/i965/brw_queryobj.c | 36 
 
  1 file changed, 27 insertions(+), 9 deletions(-)
 
 This does remove the CS stall on Ivybridge.
 
 diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c 
 b/src/mesa/drivers/dri/i965/brw_queryobj.c
 index 1e03d08..4c561ad 100644
 --- a/src/mesa/drivers/dri/i965/brw_queryobj.c
 +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
 @@ -91,17 +91,24 @@ static void
  write_depth_count(struct intel_context *intel, drm_intel_bo *query_bo, int 
 idx)
  {
 if (intel-gen = 6) {
 -  BEGIN_BATCH(9);
 -
 -  /* workaround: CS stall required before depth stall. */
 -  OUT_BATCH(_3DSTATE_PIPE_CONTROL | (4 - 2));
 -  OUT_BATCH(PIPE_CONTROL_CS_STALL);
 -  OUT_BATCH(0); /* write address */
 -  OUT_BATCH(0); /* write data */
 +  /* Emit Sandybridge workaround flush: */
 +  if (intel-gen == 6) {
 + /* The timestamp write below is a non-zero post-sync op, which on
 +  * Gen6 necessitates a CS stall.  CS stalls need stall at scoreboard
 +  * set.  See the comments for intel_emit_post_sync_nonzero_flush().
 +  */
 + BEGIN_BATCH(4);
 + OUT_BATCH(_3DSTATE_PIPE_CONTROL | (4 - 2));
 + OUT_BATCH(PIPE_CONTROL_CS_STALL | PIPE_CONTROL_STALL_AT_SCOREBOARD);
 + OUT_BATCH(0);
 + OUT_BATCH(0);
 + ADVANCE_BATCH();
 +  }
  
 +  /* Emit the actual depth count write: */
 +  BEGIN_BATCH(5);
OUT_BATCH(_3DSTATE_PIPE_CONTROL | (5 - 2));
 -  OUT_BATCH(PIPE_CONTROL_DEPTH_STALL |
 -PIPE_CONTROL_WRITE_DEPTH_COUNT);
 +  OUT_BATCH(PIPE_CONTROL_WRITE_DEPTH_COUNT);
OUT_RELOC(query_bo,
  I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
  PIPE_CONTROL_GLOBAL_GTT_WRITE |
 @@ -109,6 +116,17 @@ write_depth_count(struct intel_context *intel, 
 drm_intel_bo *query_bo, int idx)
OUT_BATCH(0);
OUT_BATCH(0);
ADVANCE_BATCH();
 +
 +  /* We need to emit a depth stall to get the right value for the depth
 +   * count.  As a workaround this needs a preceeding PIPE_CONTROL with a
 +   * non-zero post-sync op.  The depth count write above does that for 
 us.
 +   */
 +  BEGIN_BATCH(4);
 +  OUT_BATCH(_3DSTATE_PIPE_CONTROL | (4 - 2));
 +  OUT_BATCH(PIPE_CONTROL_DEPTH_STALL);
 +  OUT_BATCH(0);
 +  OUT_BATCH(0);
 +  ADVANCE_BATCH();
 } else {
BEGIN_BATCH(4);
OUT_BATCH(_3DSTATE_PIPE_CONTROL | (4 - 2) |
 -- 
 1.7.11.4
 

-- 
Daniel Vetter
Mail: dan...@ffwll.ch
Mobile: +41 (0)79 365 57 48
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 7/7] i965: Rework the extra flushes surrounding occlusion queries.

2012-08-08 Thread Daniel Vetter
On Wed, Aug 08, 2012 at 09:41:44AM +0200, Daniel Vetter wrote:
 On Tue, Aug 07, 2012 at 04:05:33PM -0700, Kenneth Graunke wrote:
  Separate out the depth stall from the depth count write.  Workarounds
  say that a depth stall needs to be preceeded with a non-zero post-sync
  op (in this case, the depth count write).  Also, before the non-zero
  post-sync op, we need a CS stall, which needs a stall at scoreboard.
  
  Signed-off-by: Daniel Vetter daniel.vet...@ffwll.ch
  Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 
 In my understanding of Bspec (haven't done any experiments on hw) we need
 to set the depth stall bit on the pipe_control with the depth_count write
 (bspec for both snbivb even says that depth stall should be disable if
 post sync op != write_depth). So I think we need to keep these two
 together and simply emit the entire nonzero postsync op workaround on
 gen6, like we already do for render cache flushes.
 
 In my reading of bspec, no such workaround is required on gen7+

I've forgotten to add: The other patches look good, for all of them safe
this on:
Reviewed-by: Daniel Vetter daniel.vet...@ffwll.ch
-- 
Daniel Vetter
Mail: dan...@ffwll.ch
Mobile: +41 (0)79 365 57 48
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] intel: use _mesa_meta_Clear with OpenGL ES 1.1

2012-08-08 Thread Tapani Pälli
Patch changes i915 and i965 drivers to use fixed function version of
meta clear when running on ES 1.1. This fixes rendering errors seen with
Google Maps, Angry Birds and Gallery3D on Android platform.

Change 88128516d43be5d25288ff5b64db63cda83c04b3 exposes all extensions
internally to be available independent of GL flavour, therefore check
against ARB_fragment_shader does not work. Alternatively intel_extensions.c
could be modified to enable/disable extension set based on version.

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
---
 src/mesa/drivers/dri/i915/intel_clear.c | 6 +++---
 src/mesa/drivers/dri/i965/brw_clear.c   | 7 ++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_clear.c 
b/src/mesa/drivers/dri/i915/intel_clear.c
index 96d9c8f..49ee2e9 100644
--- a/src/mesa/drivers/dri/i915/intel_clear.c
+++ b/src/mesa/drivers/dri/i915/intel_clear.c
@@ -179,10 +179,10 @@ intelClear(struct gl_context *ctx, GLbitfield mask)
 
if (tri_mask) {
   debug_mask(tri, tri_mask);
-  if (ctx-Extensions.ARB_fragment_shader)
-_mesa_meta_glsl_Clear(intel-ctx, tri_mask);
-  else
+  if (ctx-Version == 11)
 _mesa_meta_Clear(intel-ctx, tri_mask);
+  else
+_mesa_meta_glsl_Clear(intel-ctx, tri_mask);
}
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_clear.c 
b/src/mesa/drivers/dri/i965/brw_clear.c
index 31c2e45..42670fe 100644
--- a/src/mesa/drivers/dri/i965/brw_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_clear.c
@@ -226,7 +226,12 @@ brw_clear(struct gl_context *ctx, GLbitfield mask)
if (tri_mask) {
   debug_mask(tri, tri_mask);
   mask = ~tri_mask;
-  _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
+
+  if(ctx-Version == 11) {
+ _mesa_meta_Clear(intel-ctx, tri_mask);
+  } else {
+ _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
+  }
}
 
/* Any strange buffers get passed off to swrast */
-- 
1.7.11.2

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


[Mesa-dev] [PATCH 1/8] radeonsi: cleanup shader headers

2012-08-08 Thread Christian König
Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/drivers/radeonsi/radeonsi_pipe.h   |4 --
 src/gallium/drivers/radeonsi/radeonsi_shader.c |   28 ++
 src/gallium/drivers/radeonsi/radeonsi_shader.h |   69 +++-
 src/gallium/drivers/radeonsi/si_state.c|1 +
 src/gallium/drivers/radeonsi/si_state.h|   34 
 src/gallium/drivers/radeonsi/si_state_draw.c   |1 +
 6 files changed, 97 insertions(+), 40 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h 
b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index bde468c..9aebc6d 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -258,10 +258,6 @@ void r600_init_query_functions(struct r600_context *rctx);
 /* r600_resource.c */
 void r600_init_context_resource_functions(struct r600_context *r600);
 
-/* radeonsi_shader.c */
-int si_pipe_shader_create(struct pipe_context *ctx, struct si_pipe_shader 
*shader);
-void si_pipe_shader_destroy(struct pipe_context *ctx, struct si_pipe_shader 
*shader);
-
 /* r600_texture.c */
 void r600_init_screen_texture_functions(struct pipe_screen *screen);
 void r600_init_surface_functions(struct r600_context *r600);
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c 
b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 5313e5e..a48 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -1,4 +1,32 @@
 
+/*
+ * Copyright 2012 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Tom Stellard thomas.stell...@amd.com
+ * Michel Dänzer michel.daen...@amd.com
+ *  Christian König christian.koe...@amd.com
+ */
+
 #include gallivm/lp_bld_tgsi_action.h
 #include gallivm/lp_bld_const.h
 #include gallivm/lp_bld_gather.h
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.h 
b/src/gallium/drivers/radeonsi/radeonsi_shader.h
index cd742f5..d44ee9b 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.h
@@ -1,4 +1,69 @@
+/*
+ * Copyright 2012 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Tom Stellard thomas.stell...@amd.com
+ * Michel Dänzer michel.daen...@amd.com
+ *  Christian König christian.koe...@amd.com
+ */
 
-struct tgsi_token;
+#ifndef RADEONSI_SHADER_H
+#define RADEONSI_SHADER_H
 
-void si_test(struct tgsi_token * token, unsigned type);
+struct si_shader_io {
+   unsignedname;
+   int sid;
+   unsignedparam_offset;
+   unsignedinterpolate;
+   boolcentroid;
+};
+
+struct si_shader {
+   

[Mesa-dev] [PATCH 2/8] radeonsi: add support for PKT3 cmds to new state handling

2012-08-08 Thread Christian König
Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/drivers/radeonsi/radeonsi_pm4.c |   35 ---
 src/gallium/drivers/radeonsi/radeonsi_pm4.h |4 +++
 2 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_pm4.c 
b/src/gallium/drivers/radeonsi/radeonsi_pm4.c
index 12facaf..da680dc 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pm4.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_pm4.c
@@ -32,9 +32,30 @@
 
 #define NUMBER_OF_STATES (sizeof(union si_state) / sizeof(struct si_pm4_state 
*))
 
+void si_pm4_cmd_begin(struct si_pm4_state *state, unsigned opcode)
+{
+   state-last_opcode = opcode;
+   state-last_pm4 = state-ndw++;
+}
+
+void si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw)
+{
+   state-pm4[state-ndw++] = dw;
+}
+
+void si_pm4_cmd_end(struct si_pm4_state *state, bool predicate)
+{
+   unsigned count;
+   count = state-ndw - state-last_pm4 - 2;
+   state-pm4[state-last_pm4] = PKT3(state-last_opcode,
+  count, predicate);
+
+   assert(state-ndw = SI_PM4_MAX_DW);
+}
+
 void si_pm4_set_reg(struct si_pm4_state *state, unsigned reg, uint32_t val)
 {
-   unsigned opcode, count;
+   unsigned opcode;
 
if (reg = SI_CONFIG_REG_OFFSET  reg = SI_CONFIG_REG_END) {
opcode = PKT3_SET_CONFIG_REG;
@@ -55,17 +76,13 @@ void si_pm4_set_reg(struct si_pm4_state *state, unsigned 
reg, uint32_t val)
reg = 2;
 
if (opcode != state-last_opcode || reg != (state-last_reg + 1)) {
-   state-last_opcode = opcode;
-   state-last_pm4 = state-ndw++;
-   state-pm4[state-ndw++] = reg;
+   si_pm4_cmd_begin(state, opcode);
+   si_pm4_cmd_add(state, reg);
}
 
state-last_reg = reg;
-   count = state-ndw - state-last_pm4 - 1;
-   state-pm4[state-last_pm4] = PKT3(opcode, count, 0);
-   state-pm4[state-ndw++] = val;
-
-   assert(state-ndw = SI_PM4_MAX_DW);
+   si_pm4_cmd_add(state, val);
+   si_pm4_cmd_end(state, false);
 }
 
 void si_pm4_add_bo(struct si_pm4_state *state,
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pm4.h 
b/src/gallium/drivers/radeonsi/radeonsi_pm4.h
index 18e5183..bbddfd0 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pm4.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pm4.h
@@ -55,6 +55,10 @@ struct si_pm4_state
enum radeon_bo_usagebo_usage[SI_PM4_MAX_BO];
 };
 
+void si_pm4_cmd_begin(struct si_pm4_state *state, unsigned opcode);
+void si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw);
+void si_pm4_cmd_end(struct si_pm4_state *state, bool predicate);
+
 void si_pm4_set_reg(struct si_pm4_state *state, unsigned reg, uint32_t val);
 void si_pm4_add_bo(struct si_pm4_state *state,
   struct si_resource *bo,
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 3/8] radeonsi: move init state to new state handling

2012-08-08 Thread Christian König
Signed-off-by: Christian König deathsim...@vodafone.de
---
 .../drivers/radeonsi/evergreen_hw_context.c|1 -
 src/gallium/drivers/radeonsi/r600_hw_context.c |   16 +---
 .../drivers/radeonsi/r600_hw_context_priv.h|5 -
 src/gallium/drivers/radeonsi/radeonsi_pipe.h   |1 -
 src/gallium/drivers/radeonsi/si_state.c|5 +
 5 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/evergreen_hw_context.c 
b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
index c27221c..0d0d64b 100644
--- a/src/gallium/drivers/radeonsi/evergreen_hw_context.c
+++ b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
@@ -38,7 +38,6 @@ int si_context_init(struct r600_context *ctx)
 
ctx-cs = ctx-ws-cs_create(ctx-ws);
 
-   r600_init_cs(ctx);
ctx-max_db = 8;
return 0;
 }
diff --git a/src/gallium/drivers/radeonsi/r600_hw_context.c 
b/src/gallium/drivers/radeonsi/r600_hw_context.c
index a9be2ad..d6b3b74 100644
--- a/src/gallium/drivers/radeonsi/r600_hw_context.c
+++ b/src/gallium/drivers/radeonsi/r600_hw_context.c
@@ -128,18 +128,6 @@ static inline void r600_context_ps_partial_flush(struct 
r600_context *ctx)
ctx-flags = ~R600_CONTEXT_DRAW_PENDING;
 }
 
-void r600_init_cs(struct r600_context *ctx)
-{
-   struct radeon_winsys_cs *cs = ctx-cs;
-
-   /* All asics require this one */
-   cs-buf[cs-cdw++] = PKT3(PKT3_CONTEXT_CONTROL, 1, 0);
-   cs-buf[cs-cdw++] = 0x8000;
-   cs-buf[cs-cdw++] = 0x8000;
-
-   ctx-init_dwords = cs-cdw;
-}
-
 /* initialize */
 void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw,
boolean count_draw_in)
@@ -209,7 +197,7 @@ void r600_context_flush(struct r600_context *ctx, unsigned 
flags)
bool queries_suspended = false;
bool streamout_suspended = false;
 
-   if (cs-cdw == ctx-init_dwords)
+   if (!cs-cdw)
return;
 
/* suspend queries */
@@ -238,8 +226,6 @@ void r600_context_flush(struct r600_context *ctx, unsigned 
flags)
ctx-pm4_dirty_cdwords = 0;
ctx-flags = 0;
 
-   r600_init_cs(ctx);
-
if (streamout_suspended) {
ctx-streamout_start = TRUE;
ctx-streamout_append_bitmask = ~0;
diff --git a/src/gallium/drivers/radeonsi/r600_hw_context_priv.h 
b/src/gallium/drivers/radeonsi/r600_hw_context_priv.h
index 610f8b1..6d458d4 100644
--- a/src/gallium/drivers/radeonsi/r600_hw_context_priv.h
+++ b/src/gallium/drivers/radeonsi/r600_hw_context_priv.h
@@ -36,11 +36,6 @@
 #define PKT_COUNT_S(x)  (((x)  0x3FFF)  16)
 
 /*
- * r600_hw_context.c
- */
-void r600_init_cs(struct r600_context *ctx);
-
-/*
  * evergreen_hw_context.c
  */
 void evergreen_flush_vgt_streamout(struct r600_context *ctx);
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h 
b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index 9aebc6d..ee28065 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -181,7 +181,6 @@ struct r600_context {
struct radeon_winsys_cs *cs;
 
unsignedpm4_dirty_cdwords;
-   unsignedinit_dwords;
 
/* The list of active queries. Only one query of each type can be 
active. */
struct list_headactive_query_list;
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 1cd3610..e8a7b77 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2354,6 +2354,11 @@ void si_init_config(struct r600_context *rctx)
 {
struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
 
+   si_pm4_cmd_begin(pm4, PKT3_CONTEXT_CONTROL);
+   si_pm4_cmd_add(pm4, 0x8000);
+   si_pm4_cmd_add(pm4, 0x8000);
+   si_pm4_cmd_end(pm4, false);
+
si_pm4_set_reg(pm4, R_028A4C_PA_SC_MODE_CNTL_1, 0x0);
 
si_pm4_set_reg(pm4, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x0);
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 4/8] radeonsi: remove r6xx_flush_and_inv atom

2012-08-08 Thread Christian König
It is not used any more.

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/drivers/radeonsi/r600_state_common.c |8 
 src/gallium/drivers/radeonsi/radeonsi_pipe.h |1 -
 2 files changed, 9 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/r600_state_common.c 
b/src/gallium/drivers/radeonsi/r600_state_common.c
index ea12914..aa58406 100644
--- a/src/gallium/drivers/radeonsi/r600_state_common.c
+++ b/src/gallium/drivers/radeonsi/r600_state_common.c
@@ -49,13 +49,6 @@ static void r600_emit_surface_sync(struct r600_context 
*rctx, struct r600_atom *
a-flush_flags = 0;
 }
 
-static void r600_emit_r6xx_flush_and_inv(struct r600_context *rctx, struct 
r600_atom *atom)
-{
-   struct radeon_winsys_cs *cs = rctx-cs;
-   cs-buf[cs-cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0);
-   cs-buf[cs-cdw++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT) | 
EVENT_INDEX(0);
-}
-
 static void r600_init_atom(struct r600_atom *atom,
   void (*emit)(struct r600_context *ctx, struct 
r600_atom *state),
   unsigned num_dw,
@@ -69,7 +62,6 @@ static void r600_init_atom(struct r600_atom *atom,
 void r600_init_common_atoms(struct r600_context *rctx)
 {
r600_init_atom(rctx-atom_surface_sync.atom,   r600_emit_surface_sync, 
5, EMIT_EARLY);
-   r600_init_atom(rctx-atom_r6xx_flush_and_inv,  
r600_emit_r6xx_flush_and_inv,   2, EMIT_EARLY);
 }
 
 unsigned r600_get_cb_flush_flags(struct r600_context *rctx)
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h 
b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index ee28065..d613585 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -174,7 +174,6 @@ struct r600_context {
/* States based on r600_state. */
struct list_headdirty_states;
struct r600_atom_surface_sync   atom_surface_sync;
-   struct r600_atomatom_r6xx_flush_and_inv;
 
/* Below are variables from the old r600_context.
 */
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 5/8] radeonsi: remove ps_partial_flush

2012-08-08 Thread Christian König
Not needed any more.

Signed-off-by: Christian König deathsim...@vodafone.de
---
 .../drivers/radeonsi/evergreen_hw_context.c|   13 -
 src/gallium/drivers/radeonsi/r600.h|1 -
 src/gallium/drivers/radeonsi/r600_hw_context.c |   13 -
 src/gallium/drivers/radeonsi/si_state_draw.c   |2 +-
 4 files changed, 1 insertion(+), 28 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/evergreen_hw_context.c 
b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
index 0d0d64b..d071617 100644
--- a/src/gallium/drivers/radeonsi/evergreen_hw_context.c
+++ b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
@@ -42,19 +42,6 @@ int si_context_init(struct r600_context *ctx)
return 0;
 }
 
-static inline void evergreen_context_ps_partial_flush(struct r600_context *ctx)
-{
-   struct radeon_winsys_cs *cs = ctx-cs;
-
-   if (!(ctx-flags  R600_CONTEXT_DRAW_PENDING))
-   return;
-
-   cs-buf[cs-cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0);
-   cs-buf[cs-cdw++] = EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | 
EVENT_INDEX(4);
-
-   ctx-flags = ~R600_CONTEXT_DRAW_PENDING;
-}
-
 void si_context_draw(struct r600_context *ctx, const struct r600_draw *draw)
 {
struct radeon_winsys_cs *cs = ctx-cs;
diff --git a/src/gallium/drivers/radeonsi/r600.h 
b/src/gallium/drivers/radeonsi/r600.h
index f22d920..610b9da 100644
--- a/src/gallium/drivers/radeonsi/r600.h
+++ b/src/gallium/drivers/radeonsi/r600.h
@@ -92,7 +92,6 @@ struct r600_so_target {
unsignedso_index;
 };
 
-#define R600_CONTEXT_DRAW_PENDING  (1  0)
 #define R600_CONTEXT_DST_CACHES_DIRTY  (1  1)
 #define R600_CONTEXT_CHECK_EVENT_FLUSH (1  2)
 
diff --git a/src/gallium/drivers/radeonsi/r600_hw_context.c 
b/src/gallium/drivers/radeonsi/r600_hw_context.c
index d6b3b74..509a8bf 100644
--- a/src/gallium/drivers/radeonsi/r600_hw_context.c
+++ b/src/gallium/drivers/radeonsi/r600_hw_context.c
@@ -115,19 +115,6 @@ err:
return;
 }
 
-static inline void r600_context_ps_partial_flush(struct r600_context *ctx)
-{
-   struct radeon_winsys_cs *cs = ctx-cs;
-
-   if (!(ctx-flags  R600_CONTEXT_DRAW_PENDING))
-   return;
-
-   cs-buf[cs-cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0);
-   cs-buf[cs-cdw++] = EVENT_TYPE(EVENT_TYPE_PS_PARTIAL_FLUSH) | 
EVENT_INDEX(4);
-
-   ctx-flags = ~R600_CONTEXT_DRAW_PENDING;
-}
-
 /* initialize */
 void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw,
boolean count_draw_in)
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index d51b3f9..48a5f30 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -536,7 +536,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct 
pipe_draw_info *dinfo)
 
si_context_draw(rctx, rdraw);
 
-   rctx-flags |= R600_CONTEXT_DST_CACHES_DIRTY | 
R600_CONTEXT_DRAW_PENDING;
+   rctx-flags |= R600_CONTEXT_DST_CACHES_DIRTY;
 
if (rctx-framebuffer.zsbuf)
{
-- 
1.7.9.5

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


[Mesa-dev] [PATCH 6/8] radeonsi: separate and disable streamout for now

2012-08-08 Thread Christian König
I have my doubts that this code still works on SI.

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/drivers/radeonsi/Makefile.sources  |1 +
 .../drivers/radeonsi/evergreen_hw_context.c|   39 ---
 src/gallium/drivers/radeonsi/r600.h|2 -
 src/gallium/drivers/radeonsi/r600_hw_context.c |  132 +-
 .../drivers/radeonsi/r600_hw_context_priv.h|7 -
 src/gallium/drivers/radeonsi/radeonsi_pipe.c   |7 +
 src/gallium/drivers/radeonsi/si_state.c|   68 -
 src/gallium/drivers/radeonsi/si_state.h|   13 +
 src/gallium/drivers/radeonsi/si_state_draw.c   |2 +
 src/gallium/drivers/radeonsi/si_state_streamout.c  |  271 
 10 files changed, 301 insertions(+), 241 deletions(-)
 create mode 100644 src/gallium/drivers/radeonsi/si_state_streamout.c

diff --git a/src/gallium/drivers/radeonsi/Makefile.sources 
b/src/gallium/drivers/radeonsi/Makefile.sources
index 8e27b6c..630afb8 100644
--- a/src/gallium/drivers/radeonsi/Makefile.sources
+++ b/src/gallium/drivers/radeonsi/Makefile.sources
@@ -12,4 +12,5 @@ C_SOURCES := \
r600_state_common.c \
radeonsi_pm4.c \
si_state.c \
+   si_state_streamout.c \
si_state_draw.c
diff --git a/src/gallium/drivers/radeonsi/evergreen_hw_context.c 
b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
index d071617..56b068f 100644
--- a/src/gallium/drivers/radeonsi/evergreen_hw_context.c
+++ b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
@@ -97,42 +97,3 @@ void si_context_draw(struct r600_context *ctx, const struct 
r600_draw *draw)
}
cs-cdw += ndwords;
 }
-
-void evergreen_flush_vgt_streamout(struct r600_context *ctx)
-{
-   struct radeon_winsys_cs *cs = ctx-cs;
-
-   cs-buf[cs-cdw++] = PKT3(PKT3_SET_CONFIG_REG, 1, 0);
-   cs-buf[cs-cdw++] = (R_0084FC_CP_STRMOUT_CNTL - SI_CONFIG_REG_OFFSET) 
 2;
-   cs-buf[cs-cdw++] = 0;
-
-   cs-buf[cs-cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0);
-   cs-buf[cs-cdw++] = EVENT_TYPE(EVENT_TYPE_SO_VGTSTREAMOUT_FLUSH) | 
EVENT_INDEX(0);
-
-   cs-buf[cs-cdw++] = PKT3(PKT3_WAIT_REG_MEM, 5, 0);
-   cs-buf[cs-cdw++] = WAIT_REG_MEM_EQUAL; /* wait until the register is 
equal to the reference value */
-   cs-buf[cs-cdw++] = R_0084FC_CP_STRMOUT_CNTL  2;  /* register */
-   cs-buf[cs-cdw++] = 0;
-   cs-buf[cs-cdw++] = S_0084FC_OFFSET_UPDATE_DONE(1); /* reference value 
*/
-   cs-buf[cs-cdw++] = S_0084FC_OFFSET_UPDATE_DONE(1); /* mask */
-   cs-buf[cs-cdw++] = 4; /* poll interval */
-}
-
-void evergreen_set_streamout_enable(struct r600_context *ctx, unsigned 
buffer_enable_bit)
-{
-   struct radeon_winsys_cs *cs = ctx-cs;
-
-   if (buffer_enable_bit) {
-   cs-buf[cs-cdw++] = PKT3(PKT3_SET_CONTEXT_REG, 1, 0);
-   cs-buf[cs-cdw++] = (R_028B94_VGT_STRMOUT_CONFIG - 
SI_CONTEXT_REG_OFFSET)  2;
-   cs-buf[cs-cdw++] = S_028B94_STREAMOUT_0_EN(1);
-
-   cs-buf[cs-cdw++] = PKT3(PKT3_SET_CONTEXT_REG, 1, 0);
-   cs-buf[cs-cdw++] = (R_028B98_VGT_STRMOUT_BUFFER_CONFIG - 
SI_CONTEXT_REG_OFFSET)  2;
-   cs-buf[cs-cdw++] = 
S_028B98_STREAM_0_BUFFER_EN(buffer_enable_bit);
-   } else {
-   cs-buf[cs-cdw++] = PKT3(PKT3_SET_CONTEXT_REG, 1, 0);
-   cs-buf[cs-cdw++] = (R_028B94_VGT_STRMOUT_CONFIG - 
SI_CONTEXT_REG_OFFSET)  2;
-   cs-buf[cs-cdw++] = S_028B94_STREAMOUT_0_EN(0);
-   }
-}
diff --git a/src/gallium/drivers/radeonsi/r600.h 
b/src/gallium/drivers/radeonsi/r600.h
index 610b9da..f34d1ff 100644
--- a/src/gallium/drivers/radeonsi/r600.h
+++ b/src/gallium/drivers/radeonsi/r600.h
@@ -126,8 +126,6 @@ void r600_query_predication(struct r600_context *ctx, 
struct r600_query *query,
 void r600_context_emit_fence(struct r600_context *ctx, struct si_resource 
*fence,
  unsigned offset, unsigned value);
 
-void r600_context_streamout_begin(struct r600_context *ctx);
-void r600_context_streamout_end(struct r600_context *ctx);
 void r600_context_draw_opaque_count(struct r600_context *ctx, struct 
r600_so_target *t);
 void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, boolean 
count_draw_in);
 
diff --git a/src/gallium/drivers/radeonsi/r600_hw_context.c 
b/src/gallium/drivers/radeonsi/r600_hw_context.c
index 509a8bf..6765ef8 100644
--- a/src/gallium/drivers/radeonsi/r600_hw_context.c
+++ b/src/gallium/drivers/radeonsi/r600_hw_context.c
@@ -182,7 +182,10 @@ void r600_context_flush(struct r600_context *ctx, unsigned 
flags)
struct radeon_winsys_cs *cs = ctx-cs;
struct r600_block *enable_block = NULL;
bool queries_suspended = false;
+
+#if 0
bool streamout_suspended = false;
+#endif
 
if (!cs-cdw)
return;
@@ -193,10 +196,12 @@ void r600_context_flush(struct r600_context *ctx, 
unsigned flags)
queries_suspended = true;
}
 

[Mesa-dev] [PATCH 7/8] radeonsi: move sync handling into new state handler

2012-08-08 Thread Christian König
So we can remove all the old atom handling.

Signed-off-by: Christian König deathsim...@vodafone.de
---
 src/gallium/drivers/radeonsi/Makefile.sources|4 +-
 src/gallium/drivers/radeonsi/r600_hw_context.c   |   34 +-
 src/gallium/drivers/radeonsi/r600_state_common.c |   77 --
 src/gallium/drivers/radeonsi/radeonsi_pipe.c |4 --
 src/gallium/drivers/radeonsi/radeonsi_pipe.h |   52 ---
 src/gallium/drivers/radeonsi/radeonsi_pm4.c  |   43 +++-
 src/gallium/drivers/radeonsi/radeonsi_pm4.h  |3 +
 src/gallium/drivers/radeonsi/si_commands.c   |   39 +++
 src/gallium/drivers/radeonsi/si_state.h  |4 ++
 src/gallium/drivers/radeonsi/si_state_draw.c |   12 ++--
 10 files changed, 100 insertions(+), 172 deletions(-)
 delete mode 100644 src/gallium/drivers/radeonsi/r600_state_common.c
 create mode 100644 src/gallium/drivers/radeonsi/si_commands.c

diff --git a/src/gallium/drivers/radeonsi/Makefile.sources 
b/src/gallium/drivers/radeonsi/Makefile.sources
index 630afb8..f1b4936 100644
--- a/src/gallium/drivers/radeonsi/Makefile.sources
+++ b/src/gallium/drivers/radeonsi/Makefile.sources
@@ -9,8 +9,8 @@ C_SOURCES := \
r600_texture.c \
evergreen_hw_context.c \
r600_translate.c \
-   r600_state_common.c \
radeonsi_pm4.c \
si_state.c \
si_state_streamout.c \
-   si_state_draw.c
+   si_state_draw.c \
+   si_commands.c
diff --git a/src/gallium/drivers/radeonsi/r600_hw_context.c 
b/src/gallium/drivers/radeonsi/r600_hw_context.c
index 6765ef8..5480cb5 100644
--- a/src/gallium/drivers/radeonsi/r600_hw_context.c
+++ b/src/gallium/drivers/radeonsi/r600_hw_context.c
@@ -119,17 +119,11 @@ err:
 void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw,
boolean count_draw_in)
 {
-   struct r600_atom *state;
-
/* The number of dwords we already used in the CS so far. */
num_dw += ctx-cs-cdw;
 
if (count_draw_in) {
/* The number of dwords all the dirty states would take. */
-   LIST_FOR_EACH_ENTRY(state, ctx-dirty_states, head) {
-   num_dw += state-num_dw;
-   }
-
num_dw += ctx-pm4_dirty_cdwords;
 
/* The upper-bound of how much a draw command would take. */
@@ -159,20 +153,25 @@ void r600_need_cs_space(struct r600_context *ctx, 
unsigned num_dw,
}
 }
 
-static void r600_flush_framebuffer(struct r600_context *ctx, bool flush_now)
+static void r600_flush_framebuffer(struct r600_context *ctx)
 {
+   struct si_pm4_state *pm4 = CALLOC_STRUCT(si_pm4_state);
+
if (!(ctx-flags  R600_CONTEXT_DST_CACHES_DIRTY))
return;
 
-   ctx-atom_surface_sync.flush_flags |=
-   r600_get_cb_flush_flags(ctx) |
-   (ctx-framebuffer.zsbuf ? S_0085F0_DB_ACTION_ENA(1) | 
S_0085F0_DB_DEST_BASE_ENA(1) : 0);
-
-   if (flush_now) {
-   r600_emit_atom(ctx, ctx-atom_surface_sync.atom);
-   } else {
-   r600_atom_dirty(ctx, ctx-atom_surface_sync.atom);
-   }
+   si_cmd_surface_sync(pm4, S_0085F0_CB0_DEST_BASE_ENA(1) |
+   S_0085F0_CB1_DEST_BASE_ENA(1) |
+   S_0085F0_CB2_DEST_BASE_ENA(1) |
+   S_0085F0_CB3_DEST_BASE_ENA(1) |
+   S_0085F0_CB4_DEST_BASE_ENA(1) |
+   S_0085F0_CB5_DEST_BASE_ENA(1) |
+   S_0085F0_CB6_DEST_BASE_ENA(1) |
+   S_0085F0_CB7_DEST_BASE_ENA(1) |
+   S_0085F0_DB_ACTION_ENA(1) |
+   S_0085F0_DB_DEST_BASE_ENA(1));
+   si_pm4_emit(ctx, pm4);
+   si_pm4_free_state(ctx, pm4, ~0);
 
ctx-flags = ~R600_CONTEXT_DST_CACHES_DIRTY;
 }
@@ -180,7 +179,6 @@ static void r600_flush_framebuffer(struct r600_context 
*ctx, bool flush_now)
 void r600_context_flush(struct r600_context *ctx, unsigned flags)
 {
struct radeon_winsys_cs *cs = ctx-cs;
-   struct r600_block *enable_block = NULL;
bool queries_suspended = false;
 
 #if 0
@@ -203,7 +201,7 @@ void r600_context_flush(struct r600_context *ctx, unsigned 
flags)
}
 #endif
 
-   r600_flush_framebuffer(ctx, true);
+   r600_flush_framebuffer(ctx);
 
/* partial flush is needed to avoid lockups on some chips with user 
fences */
cs-buf[cs-cdw++] = PKT3(PKT3_EVENT_WRITE, 0, 0);
diff --git a/src/gallium/drivers/radeonsi/r600_state_common.c 
b/src/gallium/drivers/radeonsi/r600_state_common.c
deleted file mode 100644
index aa58406..000
--- a/src/gallium/drivers/radeonsi/r600_state_common.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright 2010 Red Hat Inc.
- *   2010 Jerome Glisse
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software 

[Mesa-dev] [PATCH 8/8] radeonsi: move drawing into new state handling

2012-08-08 Thread Christian König
Signed-off-by: Christian König deathsim...@vodafone.de
---
 .../drivers/radeonsi/evergreen_hw_context.c|   54 --
 src/gallium/drivers/radeonsi/r600.h|   12 ---
 src/gallium/drivers/radeonsi/si_state.h|1 +
 src/gallium/drivers/radeonsi/si_state_draw.c   |  108 +---
 4 files changed, 72 insertions(+), 103 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/evergreen_hw_context.c 
b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
index 56b068f..44fc950 100644
--- a/src/gallium/drivers/radeonsi/evergreen_hw_context.c
+++ b/src/gallium/drivers/radeonsi/evergreen_hw_context.c
@@ -42,58 +42,4 @@ int si_context_init(struct r600_context *ctx)
return 0;
 }
 
-void si_context_draw(struct r600_context *ctx, const struct r600_draw *draw)
-{
-   struct radeon_winsys_cs *cs = ctx-cs;
-   unsigned ndwords = 7;
-   uint32_t *pm4;
-   uint64_t va;
-
-   if (draw-indices) {
-   ndwords = 12;
-   }
-   if (ctx-num_cs_dw_queries_suspend)
-   ndwords += 6;
-
-   /* when increasing ndwords, bump the max limit too */
-   assert(ndwords = SI_MAX_DRAW_CS_DWORDS);
 
-   /* queries need some special values
-* (this is non-zero if any query is active) */
-   if (ctx-num_cs_dw_queries_suspend) {
-   pm4 = cs-buf[cs-cdw];
-   pm4[0] = PKT3(PKT3_SET_CONTEXT_REG, 1, 0);
-   pm4[1] = (R_028004_DB_COUNT_CONTROL - SI_CONTEXT_REG_OFFSET)  
2;
-   pm4[2] = S_028004_PERFECT_ZPASS_COUNTS(1);
-   pm4[3] = PKT3(PKT3_SET_CONTEXT_REG, 1, 0);
-   pm4[4] = (R_02800C_DB_RENDER_OVERRIDE - SI_CONTEXT_REG_OFFSET) 
 2;
-   pm4[5] = draw-db_render_override | 
S_02800C_NOOP_CULL_DISABLE(1);
-   cs-cdw += 6;
-   ndwords -= 6;
-   }
-
-   /* draw packet */
-   pm4 = cs-buf[cs-cdw];
-   pm4[0] = PKT3(PKT3_INDEX_TYPE, 0, ctx-predicate_drawing);
-   pm4[1] = draw-vgt_index_type;
-   pm4[2] = PKT3(PKT3_NUM_INSTANCES, 0, ctx-predicate_drawing);
-   pm4[3] = draw-vgt_num_instances;
-   if (draw-indices) {
-   va = r600_resource_va(ctx-screen-screen, 
(void*)draw-indices);
-   va += draw-indices_bo_offset;
-   pm4[4] = PKT3(PKT3_DRAW_INDEX_2, 4, ctx-predicate_drawing);
-   pm4[5] = (draw-indices-b.b.width0 - draw-indices_bo_offset) /
-   ctx-index_buffer.index_size;
-   pm4[6] = va;
-   pm4[7] = (va  32UL)  0xFF;
-   pm4[8] = draw-vgt_num_indices;
-   pm4[9] = draw-vgt_draw_initiator;
-   pm4[10] = PKT3(PKT3_NOP, 0, ctx-predicate_drawing);
-   pm4[11] = r600_context_bo_reloc(ctx, draw-indices, 
RADEON_USAGE_READ);
-   } else {
-   pm4[4] = PKT3(PKT3_DRAW_INDEX_AUTO, 1, ctx-predicate_drawing);
-   pm4[5] = draw-vgt_num_indices;
-   pm4[6] = draw-vgt_draw_initiator;
-   }
-   cs-cdw += ndwords;
-}
diff --git a/src/gallium/drivers/radeonsi/r600.h 
b/src/gallium/drivers/radeonsi/r600.h
index f34d1ff..df9e7a0 100644
--- a/src/gallium/drivers/radeonsi/r600.h
+++ b/src/gallium/drivers/radeonsi/r600.h
@@ -95,17 +95,6 @@ struct r600_so_target {
 #define R600_CONTEXT_DST_CACHES_DIRTY  (1  1)
 #define R600_CONTEXT_CHECK_EVENT_FLUSH (1  2)
 
-struct r600_draw {
-   uint32_tvgt_num_indices;
-   uint32_tvgt_num_instances;
-   uint32_tvgt_index_type;
-   uint32_tvgt_draw_initiator;
-   uint32_tindices_bo_offset;
-   unsigneddb_render_override;
-   unsigneddb_render_control;
-   struct si_resource  *indices;
-};
-
 struct r600_context;
 struct r600_screen;
 
@@ -130,6 +119,5 @@ void r600_context_draw_opaque_count(struct r600_context 
*ctx, struct r600_so_tar
 void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, boolean 
count_draw_in);
 
 int si_context_init(struct r600_context *ctx);
-void si_context_draw(struct r600_context *ctx, const struct r600_draw *draw);
 
 #endif
diff --git a/src/gallium/drivers/radeonsi/si_state.h 
b/src/gallium/drivers/radeonsi/si_state.h
index 475432d..87b5370 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -93,6 +93,7 @@ union si_state {
struct si_pm4_state *vertex_buffers;
struct si_pm4_state *texture_barrier;
struct si_pm4_state *draw_info;
+   struct si_pm4_state *draw;
} named;
struct si_pm4_state *array[0];
 };
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index 2510f34..0fac147 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ 

[Mesa-dev] [Bug 52140] Ubuntu Unity - Launcher and switcher icons disappeared

2012-08-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=52140

--- Comment #17 from max maniku...@gmail.com 2012-08-08 11:43:37 UTC ---
Ubuntu quantal, intel [GM965/GL960] graphics card.
Downgrading of libgl1-mesa-dri from xorg-edgers
to original quantal version helps:

apt-cache policy libgl1-mesa-dri
libgl1-mesa-dri:
  Installed: 8.0.4-1ubuntu1
  Candidate: 8.1~git20120725.cc44aa77-0ubuntu0sarvatt
  Version table:
 8.1~git20120725.cc44aa77-0ubuntu0sarvatt 0
500 http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu/ quantal/main i386
Packages
 *** 8.0.4-1ubuntu1 0
500 http://ru.archive.ubuntu.com/ubuntu/ quantal/main i386 Packages
100 /var/lib/dpkg/status

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- 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] [PATCH 1/8] radeonsi: cleanup shader headers

2012-08-08 Thread Michel Dänzer
On Mit, 2012-08-08 at 13:05 +0200, Christian König wrote: 
 + * Authors:
 + *   Tom Stellard thomas.stell...@amd.com
 + *   Michel Dänzer michel.daen...@amd.com
 + *  Christian König christian.koe...@amd.com
 + */

I'm not really a fan of such lists of authors in files, as they tend to
become stale, and the information can be obtained via Git.

Otherwise the series looks good to me.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] st/mesa: Initialize tgsi_texture_offset Padding field.

2012-08-08 Thread Jose Fonseca
Looks good.

Jose

- Original Message -
 Fixes uninitialized scalar variable defect reported by Coverity.
 
 Signed-off-by: Vinson Lee v...@freedesktop.org
 ---
  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
 b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
 index 43c80be..39717b6 100644
 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
 +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
 @@ -4178,6 +4178,7 @@ translate_tex_offset(struct st_translate *t,
 offset.SwizzleX = in_offset-SwizzleX;
 offset.SwizzleY = in_offset-SwizzleY;
 offset.SwizzleZ = in_offset-SwizzleZ;
 +   offset.Padding = 0;
  
 return offset;
  }
 --
 1.7.11.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] [PATCH] radeonsi: If pixel shader compilation fails, use a dummy shader.

2012-08-08 Thread Michel Dänzer
From: Michel Dänzer michel.daen...@amd.com

Otherwise we're likely to hang the GPU.

Signed-off-by: Michel Dänzer michel.daen...@amd.com
---
 src/gallium/drivers/radeonsi/radeonsi_pipe.c   |   10 ++
 src/gallium/drivers/radeonsi/radeonsi_pipe.h   |4 
 src/gallium/drivers/radeonsi/radeonsi_shader.c |5 -
 src/gallium/drivers/radeonsi/si_state_draw.c   |7 +++
 4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c 
b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
index 3c5eaf7..9ee96a0 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
@@ -37,6 +37,7 @@
 #include util/u_pack_color.h
 #include util/u_memory.h
 #include util/u_inlines.h
+#include util/u_simple_shaders.h
 #include util/u_upload_mgr.h
 #include vl/vl_decoder.h
 #include vl/vl_video_buffer.h
@@ -171,6 +172,9 @@ static void r600_destroy_context(struct pipe_context 
*context)
 {
struct r600_context *rctx = (struct r600_context *)context;
 
+   if (rctx-dummy_pixel_shader) {
+   rctx-context.delete_fs_state(rctx-context, 
rctx-dummy_pixel_shader);
+   }
rctx-context.delete_depth_stencil_alpha_state(rctx-context, 
rctx-custom_dsa_flush);
util_unreference_framebuffer_state(rctx-framebuffer);
 
@@ -251,6 +255,12 @@ static struct pipe_context *r600_create_context(struct 
pipe_screen *screen, void
 
r600_get_backend_mask(rctx); /* this emits commands and must be last */
 
+   rctx-dummy_pixel_shader =
+   util_make_fragment_cloneinput_shader(rctx-context, 0,
+TGSI_SEMANTIC_GENERIC,
+TGSI_INTERPOLATE_CONSTANT);
+   rctx-context.bind_fs_state(rctx-context, rctx-dummy_pixel_shader);
+
return rctx-context;
 }
 
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h 
b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index bde468c..3bba6d1 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -206,6 +206,10 @@ struct r600_context {
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
unsignednr_vertex_buffers;
 
+   /* With rasterizer discard, there doesn't have to be a pixel shader.
+* In that case, we bind this one: */
+   struct si_pipe_shader   *dummy_pixel_shader;
+
/* SI state handling */
union si_state  queued;
union si_state  emitted;
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c 
b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 5313e5e..a050617 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -627,7 +627,10 @@ int si_pipe_shader_create(
tgsi_dump(shader-tokens, 0);
}
 
-   lp_build_tgsi_llvm(bld_base, shader-tokens);
+   if (!lp_build_tgsi_llvm(bld_base, shader-tokens)) {
+   fprintf(stderr, Failed to translate shader from TGSI to 
LLVM\n);
+   return -EINVAL;
+   }
 
radeon_llvm_finalize_module(si_shader_ctx.radeon_bld);
 
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index 0d9f009..7af1944 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -373,6 +373,13 @@ static void si_update_derived_state(struct r600_context 
*rctx)
if (!rctx-ps_shader-bo) {
si_pipe_shader_ps(ctx, rctx-ps_shader);
}
+   if (!rctx-ps_shader-bo) {
+   if (!rctx-dummy_pixel_shader-bo)
+   si_pipe_shader_ps(ctx, rctx-dummy_pixel_shader);
+
+   if (rctx-dummy_pixel_shader-pm4)
+   si_pm4_bind_state(rctx, vs, 
rctx-dummy_pixel_shader-pm4);
+   }
 
if (rctx-shader_dirty) {
si_update_spi_map(rctx);
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH] radeonsi: If pixel shader compilation fails, use a dummy shader.

2012-08-08 Thread Alex Deucher
On Wed, Aug 8, 2012 at 9:37 AM, Michel Dänzer mic...@daenzer.net wrote:
 From: Michel Dänzer michel.daen...@amd.com

 Otherwise we're likely to hang the GPU.

 Signed-off-by: Michel Dänzer michel.daen...@amd.com

Reviewed-by: Alex Deucher alexander.deuc...@amd.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/4] gallivm: remove unused src_elem_type variable

2012-08-08 Thread Brian Paul
---
 .../auxiliary/gallivm/lp_bld_format_aos_array.c|3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c 
b/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c
index b8ec379..b163fbc 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c
@@ -54,7 +54,7 @@ lp_build_fetch_rgba_aos_array(struct gallivm_state *gallivm,
 {
struct lp_build_context bld;
LLVMBuilderRef builder = gallivm-builder;
-   LLVMTypeRef src_elem_type, src_vec_type;
+   LLVMTypeRef src_vec_type;
LLVMValueRef ptr, res = NULL;
struct lp_type src_type;
 
@@ -68,7 +68,6 @@ lp_build_fetch_rgba_aos_array(struct gallivm_state *gallivm,
 
assert(src_type.length = dst_type.length);
 
-   src_elem_type = lp_build_elem_type(gallivm, src_type);
src_vec_type  = lp_build_vec_type(gallivm,  src_type);
 
/* Read whole vector from memory, unaligned */
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 1/4] svga: remove unused svga_winsys_handle type

2012-08-08 Thread Brian Paul
---
 src/gallium/drivers/svga/svga_winsys.h |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_winsys.h 
b/src/gallium/drivers/svga/svga_winsys.h
index d9560ef..f410cf0 100644
--- a/src/gallium/drivers/svga/svga_winsys.h
+++ b/src/gallium/drivers/svga/svga_winsys.h
@@ -67,9 +67,6 @@ struct winsys_handle;
 /** Opaque surface handle */
 struct svga_winsys_surface;
 
-/** Opaque buffer handle */
-struct svga_winsys_handle;
-
 
 /**
  * SVGA per-context winsys interface.
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 2/4] svga: remove unused svga_shader::use_sm30 field, add comments

2012-08-08 Thread Brian Paul
---
 src/gallium/drivers/svga/svga_context.h |4 +---
 src/gallium/drivers/svga/svga_tgsi.h|9 -
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_context.h 
b/src/gallium/drivers/svga/svga_context.h
index 7567431..f243b4f 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -57,9 +57,7 @@ struct svga_shader
 
struct svga_shader_result *results;
 
-   unsigned id;
-
-   boolean use_sm30;
+   unsigned id;  /** for debugging only */
 };
 
 struct svga_fragment_shader
diff --git a/src/gallium/drivers/svga/svga_tgsi.h 
b/src/gallium/drivers/svga/svga_tgsi.h
index bb0c6d0..0e06dbf 100644
--- a/src/gallium/drivers/svga/svga_tgsi.h
+++ b/src/gallium/drivers/svga/svga_tgsi.h
@@ -79,6 +79,12 @@ struct svga_compile_key {
int8_t generic_remap_table[MAX_GENERIC_VARYING];
 };
 
+
+/**
+ * A single TGSI shader may be compiled into different variants of
+ * SVGA3D shaders depending on the compile key.  Each user shader
+ * will have a linked list of these results.
+ */
 struct svga_shader_result
 {
const struct svga_shader *shader;
@@ -92,7 +98,8 @@ struct svga_shader_result
const unsigned *tokens;
unsigned nr_tokens;
 
-   /* SVGA Shader ID:
+   /** Per-context shader identifier used with SVGA_3D_CMD_SHADER_DEFINE,
+* SVGA_3D_CMD_SET_SHADER and SVGA_3D_CMD_SHADER_DESTROY.
 */
unsigned id;

-- 
1.7.3.4

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


[Mesa-dev] [PATCH 4/4] swrast: add missing switch case for API_OPENGL_CORE

2012-08-08 Thread Brian Paul
To silence compiler warning.
---
 src/mesa/drivers/dri/swrast/swrast.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
b/src/mesa/drivers/dri/swrast/swrast.c
index 22d71bf..ca6bda02 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -771,6 +771,8 @@ dri_create_context(gl_api api,
 _mesa_enable_sw_extensions(mesaCtx);
 
 switch (api) {
+case API_OPENGL_CORE:
+/* XXX fix me, fall-through for now */
 case API_OPENGL:
 _mesa_enable_1_3_extensions(mesaCtx);
 _mesa_enable_1_4_extensions(mesaCtx);
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH 1/4] svga: remove unused svga_winsys_handle type

2012-08-08 Thread Jose Fonseca
Series looks good to me

Reviewed-by: Jose Fonseca jfons...@vmware.com

- Original Message -
 ---
  src/gallium/drivers/svga/svga_winsys.h |3 ---
  1 files changed, 0 insertions(+), 3 deletions(-)
 
 diff --git a/src/gallium/drivers/svga/svga_winsys.h
 b/src/gallium/drivers/svga/svga_winsys.h
 index d9560ef..f410cf0 100644
 --- a/src/gallium/drivers/svga/svga_winsys.h
 +++ b/src/gallium/drivers/svga/svga_winsys.h
 @@ -67,9 +67,6 @@ struct winsys_handle;
  /** Opaque surface handle */
  struct svga_winsys_surface;
  
 -/** Opaque buffer handle */
 -struct svga_winsys_handle;
 -
  
  /**
   * SVGA per-context winsys interface.
 --
 1.7.3.4
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 44912] [bisected] WebGL conformance/textures/texture-mips tests fails

2012-08-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44912

Andreas Boll andreas.boll@gmail.com changed:

   What|Removed |Added

 CC||jlp.b...@gmail.com

--- Comment #4 from Andreas Boll andreas.boll@gmail.com 2012-08-08 
15:35:58 UTC ---
*** Bug 48935 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- 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 42883] Firefox crashes in state_tracker/st_cb_blit.c:87

2012-08-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=42883

Andreas Boll andreas.boll@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #5 from Andreas Boll andreas.boll@gmail.com 2012-08-08 
15:48:10 UTC ---
(In reply to comment #3)
 (In reply to comment #2)
 
 Mesa Works again. Thx.

Confirmed.
Works with mesa 8.0-stable and mesa master:

WebGL Renderer: X.Org -- Gallium 0.4 on AMD RV770 -- 2.1 Mesa 8.0.3
WebGL Renderer: X.Org -- Gallium 0.4 on AMD RV770 -- 2.1 Mesa 8.1-devel
(git-be42a45)

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- 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] [PATCH 7/7] i965: Rework the extra flushes surrounding occlusion queries.

2012-08-08 Thread Eric Anholt
Kenneth Graunke kenn...@whitecape.org writes:

 Separate out the depth stall from the depth count write.  Workarounds
 say that a depth stall needs to be preceeded with a non-zero post-sync
 op (in this case, the depth count write).  Also, before the non-zero
 post-sync op, we need a CS stall, which needs a stall at scoreboard.

 Signed-off-by: Daniel Vetter daniel.vet...@ffwll.ch
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org

This series is:

Reviewed-by: Eric Anholt e...@anholt.net


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


Re: [Mesa-dev] [PATCH] intel: use _mesa_meta_Clear with OpenGL ES 1.1

2012-08-08 Thread Tapani Pälli
On 08/08/2012 07:33 PM, Kenneth Graunke wrote:
 On 08/08/2012 01:34 AM, Tapani Pälli wrote:
 Patch changes i915 and i965 drivers to use fixed function version of
 meta clear when running on ES 1.1. This fixes rendering errors seen with
 Google Maps, Angry Birds and Gallery3D on Android platform.

 Change 88128516d43be5d25288ff5b64db63cda83c04b3 exposes all extensions
 internally to be available independent of GL flavour, therefore check
 against ARB_fragment_shader does not work. Alternatively intel_extensions.c
 could be modified to enable/disable extension set based on version.

 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 ---
  src/mesa/drivers/dri/i915/intel_clear.c | 6 +++---
  src/mesa/drivers/dri/i965/brw_clear.c   | 7 ++-
  2 files changed, 9 insertions(+), 4 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i915/intel_clear.c 
 b/src/mesa/drivers/dri/i915/intel_clear.c
 index 96d9c8f..49ee2e9 100644
 --- a/src/mesa/drivers/dri/i915/intel_clear.c
 +++ b/src/mesa/drivers/dri/i915/intel_clear.c
 @@ -179,10 +179,10 @@ intelClear(struct gl_context *ctx, GLbitfield mask)
  
 if (tri_mask) {
debug_mask(tri, tri_mask);
 -  if (ctx-Extensions.ARB_fragment_shader)
 - _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
 -  else
 +  if (ctx-Version == 11)
 
 I would prefer to see:
if (ctx-API == API_OPENGLES)
 
   _mesa_meta_Clear(intel-ctx, tri_mask);
 +  else
 + _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
 }
  }
  
 diff --git a/src/mesa/drivers/dri/i965/brw_clear.c 
 b/src/mesa/drivers/dri/i965/brw_clear.c
 index 31c2e45..42670fe 100644
 --- a/src/mesa/drivers/dri/i965/brw_clear.c
 +++ b/src/mesa/drivers/dri/i965/brw_clear.c
 @@ -226,7 +226,12 @@ brw_clear(struct gl_context *ctx, GLbitfield mask)
 if (tri_mask) {
debug_mask(tri, tri_mask);
mask = ~tri_mask;
 -  _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
 +
 +  if(ctx-Version == 11) {
 
 Ditto.
 
 + _mesa_meta_Clear(intel-ctx, tri_mask);
 +  } else {
 + _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
 +  }
 }
  
 /* Any strange buffers get passed off to swrast */

 
 I'm not sure that we want to go back to using _mesa_meta_Clear...we want
 to be able to use GLSL internally, even on ES 1.x---we just can't expose
 the API to the user.
 
 I did some analysis about why glsl_Clear breaks on ES1 here:
 https://bugs.freedesktop.org/show_bug.cgi?id=50333

OK, this is interesting, I will get more familiar with this.

 That said, this is a small patch that gets things working in the
 meantime, so with the Version = API changes, you can add:
 
 Reviewed-by: Kenneth Graunke kenn...@whitecape.org
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50333

Thanks Kenneth, I will fix the patch.



-- 

// Tapani




signature.asc
Description: OpenPGP digital signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glx/dri: Initialize reset to __DRI_CTX_RESET_NO_NOTIFICATION.

2012-08-08 Thread Ian Romanick

On 08/06/2012 04:49 PM, Kenneth Graunke wrote:

I noticed that we have a bit of inconsistency in how we handle context
defaults.  In some cases, we initialize variables with default values in
dri{2,sw}_create_context_attribs.  In other cases, we rely on
dri2_convert_glx_attribs to do that for us.

For example, in dri2_convert_glx_attribs:

 uint32_t minor_ver = 1;
 uint32_t major_ver = 2;
 uint32_t flags = 0;
 unsigned api;
 int reset;


Oh... that's broken.  I had intended to default to 1.2 because the Linux 
ABI requires at least version 1.2.




we default the version to 2.1.  Whereas in dri_convert_glx_attribs we have:

if (num_attribs == 0) {
   *api = __DRI_API_OPENGL;
   return true;
}
...
*major_ver = 1;
*minor_ver = 0;
*reset = __DRI_CTX_RESET_NO_NOTIFICATION;

So if they try to create a context with _no_ attributes, we pick 2.1.
If they specify _some_ attributes, but not version attributes, we hit
this code and pick 1.0.  drisw_create_context_attribs also defaults to 1.0.

My feeling is that we should either make dri2_convert_glx_attribs not
short-circuit on num_attribs == 0, so it fully initializes all the
defaults, or we should make both the callers fully specify defaults and
remove the block that makes it set them.  Either would work, but it'd be
nice to pick one.


I'd lean towards the former... with a unit test to make sure.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2] i965: Rework the extra flushes surrounding occlusion queries.

2012-08-08 Thread Kenneth Graunke
This removes the CS stall on Ivybridge.

On Sandybridge, the depth stall needs to be preceded by a non-zero
post-sync op, which requires a CS stall, which needs a stall at
scoreboard.  Emit the full workaround.

Cc: Daniel Vetter daniel.vet...@ffwll.ch
Cc: Eric Anholt e...@anholt.net
Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/mesa/drivers/dri/i965/brw_queryobj.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

v2: Keep depth count write and depth stall together.  Do the full
post-sync non-zero workaround.  This seems much safer to me.

Daniel: the irony, of course, is that the part you objected to came
from the first patch in your series... :)

diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c 
b/src/mesa/drivers/dri/i965/brw_queryobj.c
index 1e03d08..b39f644 100644
--- a/src/mesa/drivers/dri/i965/brw_queryobj.c
+++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
@@ -91,14 +91,11 @@ static void
 write_depth_count(struct intel_context *intel, drm_intel_bo *query_bo, int idx)
 {
if (intel-gen = 6) {
-  BEGIN_BATCH(9);
-
-  /* workaround: CS stall required before depth stall. */
-  OUT_BATCH(_3DSTATE_PIPE_CONTROL | (4 - 2));
-  OUT_BATCH(PIPE_CONTROL_CS_STALL);
-  OUT_BATCH(0); /* write address */
-  OUT_BATCH(0); /* write data */
+  /* Emit Sandybridge workaround flush: */
+  if (intel-gen == 6)
+ intel_emit_post_sync_nonzero_flush(intel);
 
+  BEGIN_BATCH(5);
   OUT_BATCH(_3DSTATE_PIPE_CONTROL | (5 - 2));
   OUT_BATCH(PIPE_CONTROL_DEPTH_STALL |
 PIPE_CONTROL_WRITE_DEPTH_COUNT);
-- 
1.7.11.4

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


[Mesa-dev] [PATCH 01/14] mesa: Don't advertise deprecated extensions in a core context

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

It may be possible to trim the list of extensions futher.  These are
just the obvious extensions that add functionality that the core context
explicitly forbids.  Apple's core-context extension list is *just* the
extensions on top of the core GL version.  I'm not sure we want to go
that far, but removing some things that have been in core since 2.1 may
be okay.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/extensions.c |   98 ++--
 1 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 5e13a93..41ab7f5 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -95,8 +95,8 @@ static const struct extension extension_table[] = {
{ GL_ARB_draw_instanced,  o(ARB_draw_instanced),  
GL, 2008 },
{ GL_ARB_explicit_attrib_location,
o(ARB_explicit_attrib_location),GL, 2009 },
{ GL_ARB_fragment_coord_conventions,  
o(ARB_fragment_coord_conventions),  GL, 2009 },
-   { GL_ARB_fragment_program,o(ARB_fragment_program),
GL, 2002 },
-   { GL_ARB_fragment_program_shadow, 
o(ARB_fragment_program_shadow), GL, 2003 },
+   { GL_ARB_fragment_program,o(ARB_fragment_program),
GLL,2002 },
+   { GL_ARB_fragment_program_shadow, 
o(ARB_fragment_program_shadow), GLL,2003 },
{ GL_ARB_fragment_shader, o(ARB_fragment_shader), 
GL, 2002 },
{ GL_ARB_framebuffer_object,  o(ARB_framebuffer_object),  
GL, 2005 },
{ GL_ARB_framebuffer_sRGB,o(EXT_framebuffer_sRGB),
GL, 1998 },
@@ -119,7 +119,7 @@ static const struct extension extension_table[] = {
{ GL_ARB_shader_objects,  o(ARB_shader_objects),  
GL, 2002 },
{ GL_ARB_shader_stencil_export,   
o(ARB_shader_stencil_export),   GL, 2009 },
{ GL_ARB_shader_texture_lod,  o(ARB_shader_texture_lod),  
GL, 2009 },
-   { GL_ARB_shading_language_100,
o(ARB_shading_language_100),GL, 2003 },
+   { GL_ARB_shading_language_100,
o(ARB_shading_language_100),GLL,2003 },
{ GL_ARB_shadow_ambient,  o(ARB_shadow_ambient),  
GL, 2001 },
{ GL_ARB_shadow,  o(ARB_shadow),  
GL, 2001 },
{ GL_ARB_sync,o(ARB_sync),
GL, 2003 },
@@ -128,10 +128,10 @@ static const struct extension extension_table[] = {
{ GL_ARB_texture_compression, o(dummy_true),  
GL, 2000 },
{ GL_ARB_texture_compression_rgtc,
o(ARB_texture_compression_rgtc),GL, 2004 },
{ GL_ARB_texture_cube_map,o(ARB_texture_cube_map),
GL, 1999 },
-   { GL_ARB_texture_env_add, o(dummy_true),  
GL, 1999 },
-   { GL_ARB_texture_env_combine, o(ARB_texture_env_combine), 
GL, 2001 },
-   { GL_ARB_texture_env_crossbar,
o(ARB_texture_env_crossbar),GL, 2001 },
-   { GL_ARB_texture_env_dot3,o(ARB_texture_env_dot3),
GL, 2001 },
+   { GL_ARB_texture_env_add, o(dummy_true),  
GLL,1999 },
+   { GL_ARB_texture_env_combine, o(ARB_texture_env_combine), 
GLL,2001 },
+   { GL_ARB_texture_env_crossbar,
o(ARB_texture_env_crossbar),GLL,2001 },
+   { GL_ARB_texture_env_dot3,o(ARB_texture_env_dot3),
GLL,2001 },
{ GL_ARB_texture_float,   o(ARB_texture_float),   
GL, 2004 },
{ GL_ARB_texture_mirrored_repeat, o(dummy_true),  
GL, 2001 },
{ GL_ARB_texture_multisample, o(ARB_texture_multisample), 
GL, 2009 },
@@ -145,15 +145,15 @@ static const struct extension extension_table[] = {
{ GL_ARB_transform_feedback2, o(ARB_transform_feedback2), 
GL, 2010 },
{ 

[Mesa-dev] [PATCH 02/14] mesa: Don't advertise extensions that are part of GL 1.2 in a core context

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/extensions.c |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 41ab7f5..1402718 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -156,19 +156,19 @@ static const struct extension extension_table[] = {
{ GL_ARB_window_pos,  o(ARB_window_pos),  
GLL,2001 },
/* EXT extensions */
{ GL_EXT_abgr,o(dummy_true),  
GL, 1995 },
-   { GL_EXT_bgra,o(dummy_true),  
GL, 1995 },
-   { GL_EXT_blend_color, o(EXT_blend_color), 
GL, 1995 },
+   { GL_EXT_bgra,o(dummy_true),  
GLL,1995 },
+   { GL_EXT_blend_color, o(EXT_blend_color), 
GLL,1995 },
{ GL_EXT_blend_equation_separate, 
o(EXT_blend_equation_separate), GL, 2003 },
{ GL_EXT_blend_func_separate, o(EXT_blend_func_separate), 
GL, 1999 },
-   { GL_EXT_blend_minmax,o(EXT_blend_minmax),
GL | ES1 | ES2, 1995 },
-   { GL_EXT_blend_subtract,  o(dummy_true),  
GL, 1995 },
+   { GL_EXT_blend_minmax,o(EXT_blend_minmax),
GLL | ES1 | ES2, 1995 },
+   { GL_EXT_blend_subtract,  o(dummy_true),  
GLL,1995 },
{ GL_EXT_clip_volume_hint,o(EXT_clip_volume_hint),
GL, 1996 },
{ GL_EXT_compiled_vertex_array,   
o(EXT_compiled_vertex_array),   GLL,1996 },
{ GL_EXT_copy_texture,o(dummy_true),  
GLL,1995 },
{ GL_EXT_depth_bounds_test,   o(EXT_depth_bounds_test),   
GL, 2002 },
{ GL_EXT_draw_buffers2,   o(EXT_draw_buffers2),   
GL, 2006 },
{ GL_EXT_draw_instanced,  o(ARB_draw_instanced),  
GL, 2006 },
-   { GL_EXT_draw_range_elements, o(EXT_draw_range_elements), 
GL, 1997 },
+   { GL_EXT_draw_range_elements, o(EXT_draw_range_elements), 
GLL,1997 },
{ GL_EXT_fog_coord,   o(EXT_fog_coord),   
GLL,1999 },
{ GL_EXT_framebuffer_blit,o(EXT_framebuffer_blit),
GL, 2005 },
{ GL_EXT_framebuffer_multisample, 
o(EXT_framebuffer_multisample), GL, 2005 },
@@ -179,7 +179,7 @@ static const struct extension extension_table[] = {
{ GL_EXT_multi_draw_arrays,   o(dummy_true),  
GL | ES1 | ES2, 1999 },
{ GL_EXT_packed_depth_stencil,
o(EXT_packed_depth_stencil),GL, 2005 },
{ GL_EXT_packed_float,o(EXT_packed_float),
GL, 2004 },
-   { GL_EXT_packed_pixels,   o(EXT_packed_pixels),   
GL, 1997 },
+   { GL_EXT_packed_pixels,   o(EXT_packed_pixels),   
GLL,1997 },
{ GL_EXT_pixel_buffer_object, o(EXT_pixel_buffer_object), 
GL, 2004 },
{ GL_EXT_point_parameters,o(EXT_point_parameters),
GL, 1997 },
{ GL_EXT_polygon_offset,  o(dummy_true),  
GLL,1995 },
@@ -192,14 +192,14 @@ static const struct extension extension_table[] = {
{ GL_EXT_stencil_two_side,o(EXT_stencil_two_side),
GLL,2001 },
{ GL_EXT_stencil_wrap,o(dummy_true),  
GL, 2002 },
{ GL_EXT_subtexture,  o(dummy_true),  
GLL,1995 },
-   { GL_EXT_texture3D,   o(EXT_texture3D),   
GL, 1996 },
+   { GL_EXT_texture3D,   o(EXT_texture3D),   
GLL,1996 },
{ GL_EXT_texture_array,   o(EXT_texture_array),   
  

[Mesa-dev] [PATCH 03/14] mesa: Don't advertise extensions that are part of GL 1.3 in a core context

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/extensions.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 1402718..5115d42 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -104,8 +104,8 @@ static const struct extension extension_table[] = {
{ GL_ARB_half_float_vertex,   o(ARB_half_float_vertex),   
GL, 2008 },
{ GL_ARB_instanced_arrays,o(ARB_instanced_arrays),
GL, 2008 },
{ GL_ARB_map_buffer_range,o(ARB_map_buffer_range),
GL, 2008 },
-   { GL_ARB_multisample, o(dummy_true),  
GL, 1994 },
-   { GL_ARB_multitexture,o(dummy_true),  
GL, 1998 },
+   { GL_ARB_multisample, o(dummy_true),  
GLL,1994 },
+   { GL_ARB_multitexture,o(dummy_true),  
GLL,1998 },
{ GL_ARB_occlusion_query2,o(ARB_occlusion_query2),
GL, 2003 },
{ GL_ARB_occlusion_query, o(ARB_occlusion_query), 
GL, 2001 },
{ GL_ARB_pixel_buffer_object, o(EXT_pixel_buffer_object), 
GL, 2004 },
@@ -123,11 +123,11 @@ static const struct extension extension_table[] = {
{ GL_ARB_shadow_ambient,  o(ARB_shadow_ambient),  
GL, 2001 },
{ GL_ARB_shadow,  o(ARB_shadow),  
GL, 2001 },
{ GL_ARB_sync,o(ARB_sync),
GL, 2003 },
-   { GL_ARB_texture_border_clamp,
o(ARB_texture_border_clamp),GL, 2000 },
+   { GL_ARB_texture_border_clamp,
o(ARB_texture_border_clamp),GLL,2000 },
{ GL_ARB_texture_buffer_object,   
o(ARB_texture_buffer_object),   GL, 2008 },
-   { GL_ARB_texture_compression, o(dummy_true),  
GL, 2000 },
+   { GL_ARB_texture_compression, o(dummy_true),  
GLL,2000 },
{ GL_ARB_texture_compression_rgtc,
o(ARB_texture_compression_rgtc),GL, 2004 },
-   { GL_ARB_texture_cube_map,o(ARB_texture_cube_map),
GL, 1999 },
+   { GL_ARB_texture_cube_map,o(ARB_texture_cube_map),
GLL,1999 },
{ GL_ARB_texture_env_add, o(dummy_true),  
GLL,1999 },
{ GL_ARB_texture_env_combine, o(ARB_texture_env_combine), 
GLL,2001 },
{ GL_ARB_texture_env_crossbar,
o(ARB_texture_env_crossbar),GLL,2001 },
@@ -316,7 +316,7 @@ static const struct extension extension_table[] = {
{ GL_NV_vertex_program,   o(NV_vertex_program),   
GLL,2000 },
{ GL_S3_s3tc, o(S3_s3tc), 
GL, 1999 },
{ GL_SGIS_generate_mipmap,o(dummy_true),  
GLL,1997 },
-   { GL_SGIS_texture_border_clamp,   
o(ARB_texture_border_clamp),GL, 1997 },
+   { GL_SGIS_texture_border_clamp,   
o(ARB_texture_border_clamp),GLL,1997 },
{ GL_SGIS_texture_edge_clamp, o(dummy_true),  
GLL,1997 },
{ GL_SGIS_texture_lod,o(SGIS_texture_lod),
GLL,1997 },
{ GL_SUN_multi_draw_arrays,   o(dummy_true),  
GL, 1999 },
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 04/14] mesa: Don't advertise extensions that are part of GL 1.4 in a core context

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/extensions.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 5115d42..cca1eac 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -88,7 +88,7 @@ static const struct extension extension_table[] = {
{ GL_ARB_debug_output,o(dummy_true),  
GL, 2009 },
{ GL_ARB_depth_buffer_float,  o(ARB_depth_buffer_float),  
GL, 2008 },
{ GL_ARB_depth_clamp, o(ARB_depth_clamp), 
GL, 2003 },
-   { GL_ARB_depth_texture,   o(ARB_depth_texture),   
GL, 2001 },
+   { GL_ARB_depth_texture,   o(ARB_depth_texture),   
GLL,2001 },
{ GL_ARB_draw_buffers,o(dummy_true),  
GL, 2002 },
{ GL_ARB_draw_buffers_blend,  o(ARB_draw_buffers_blend),  
GL, 2009 },
{ GL_ARB_draw_elements_base_vertex,   
o(ARB_draw_elements_base_vertex),   GL, 2009 },
@@ -109,7 +109,7 @@ static const struct extension extension_table[] = {
{ GL_ARB_occlusion_query2,o(ARB_occlusion_query2),
GL, 2003 },
{ GL_ARB_occlusion_query, o(ARB_occlusion_query), 
GL, 2001 },
{ GL_ARB_pixel_buffer_object, o(EXT_pixel_buffer_object), 
GL, 2004 },
-   { GL_ARB_point_parameters,o(EXT_point_parameters),
GL, 1997 },
+   { GL_ARB_point_parameters,o(EXT_point_parameters),
GLL,1997 },
{ GL_ARB_point_sprite,o(ARB_point_sprite),
GL, 2003 },
{ GL_ARB_provoking_vertex,o(EXT_provoking_vertex),
GL, 2009 },
{ GL_ARB_robustness,  o(dummy_true),  
GL, 2010 },
@@ -121,7 +121,7 @@ static const struct extension extension_table[] = {
{ GL_ARB_shader_texture_lod,  o(ARB_shader_texture_lod),  
GL, 2009 },
{ GL_ARB_shading_language_100,
o(ARB_shading_language_100),GLL,2003 },
{ GL_ARB_shadow_ambient,  o(ARB_shadow_ambient),  
GL, 2001 },
-   { GL_ARB_shadow,  o(ARB_shadow),  
GL, 2001 },
+   { GL_ARB_shadow,  o(ARB_shadow),  
GLL,2001 },
{ GL_ARB_sync,o(ARB_sync),
GL, 2003 },
{ GL_ARB_texture_border_clamp,
o(ARB_texture_border_clamp),GLL,2000 },
{ GL_ARB_texture_buffer_object,   
o(ARB_texture_buffer_object),   GL, 2008 },
@@ -133,7 +133,7 @@ static const struct extension extension_table[] = {
{ GL_ARB_texture_env_crossbar,
o(ARB_texture_env_crossbar),GLL,2001 },
{ GL_ARB_texture_env_dot3,o(ARB_texture_env_dot3),
GLL,2001 },
{ GL_ARB_texture_float,   o(ARB_texture_float),   
GL, 2004 },
-   { GL_ARB_texture_mirrored_repeat, o(dummy_true),  
GL, 2001 },
+   { GL_ARB_texture_mirrored_repeat, o(dummy_true),  
GLL,2001 },
{ GL_ARB_texture_multisample, o(ARB_texture_multisample), 
GL, 2009 },
{ GL_ARB_texture_non_power_of_two,
o(ARB_texture_non_power_of_two),GL, 2003 },
{ GL_ARB_texture_rectangle,   o(NV_texture_rectangle),
GL, 2004 },
@@ -159,7 +159,7 @@ static const struct extension extension_table[] = {
{ GL_EXT_bgra,o(dummy_true),  
GLL,1995 },
{ GL_EXT_blend_color, o(EXT_blend_color), 
GLL,1995 },
{ GL_EXT_blend_equation_separate, 
o(EXT_blend_equation_separate), GL, 2003 },
-   { GL_EXT_blend_func_separate, o(EXT_blend_func_separate), 

[Mesa-dev] [PATCH 05/14] mesa: Don't advertise extensions that are part of GL 1.5 in a core context

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/extensions.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index cca1eac..521fe14 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -107,7 +107,7 @@ static const struct extension extension_table[] = {
{ GL_ARB_multisample, o(dummy_true),  
GLL,1994 },
{ GL_ARB_multitexture,o(dummy_true),  
GLL,1998 },
{ GL_ARB_occlusion_query2,o(ARB_occlusion_query2),
GL, 2003 },
-   { GL_ARB_occlusion_query, o(ARB_occlusion_query), 
GL, 2001 },
+   { GL_ARB_occlusion_query, o(ARB_occlusion_query), 
GLL,2001 },
{ GL_ARB_pixel_buffer_object, o(EXT_pixel_buffer_object), 
GL, 2004 },
{ GL_ARB_point_parameters,o(EXT_point_parameters),
GLL,1997 },
{ GL_ARB_point_sprite,o(ARB_point_sprite),
GL, 2003 },
@@ -149,7 +149,7 @@ static const struct extension extension_table[] = {
{ GL_ARB_uniform_buffer_object,   
o(ARB_uniform_buffer_object),   GL, 2009 },
{ GL_ARB_vertex_array_bgra,   o(EXT_vertex_array_bgra),   
GL, 2008 },
{ GL_ARB_vertex_array_object, o(ARB_vertex_array_object), 
GL, 2006 },
-   { GL_ARB_vertex_buffer_object,o(dummy_true),  
GL, 2003 },
+   { GL_ARB_vertex_buffer_object,o(dummy_true),  
GLL,2003 },
{ GL_ARB_vertex_program,  o(ARB_vertex_program),  
GLL,2002 },
{ GL_ARB_vertex_shader,   o(ARB_vertex_shader),   
GL, 2002 },
{ GL_ARB_vertex_type_2_10_10_10_rev,  
o(ARB_vertex_type_2_10_10_10_rev),  GL, 2009 },
@@ -188,7 +188,7 @@ static const struct extension extension_table[] = {
{ GL_EXT_secondary_color, o(EXT_secondary_color), 
GLL,1999 },
{ GL_EXT_separate_shader_objects, 
o(EXT_separate_shader_objects), GLL,2008 },
{ GL_EXT_separate_specular_color, 
o(EXT_separate_specular_color), GLL,1997 },
-   { GL_EXT_shadow_funcs,o(EXT_shadow_funcs),
GL, 2002 },
+   { GL_EXT_shadow_funcs,o(EXT_shadow_funcs),
GLL,2002 },
{ GL_EXT_stencil_two_side,o(EXT_stencil_two_side),
GLL,2001 },
{ GL_EXT_stencil_wrap,o(dummy_true),  
GLL,2002 },
{ GL_EXT_subtexture,  o(dummy_true),  
GLL,1995 },
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 06/14] mesa: Filter a bunch more functions based on API

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/api_exec.c |  204 ++
 1 files changed, 115 insertions(+), 89 deletions(-)

diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 81be46d..67f17a4 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -158,7 +158,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_GetError(exec, _mesa_GetError);
SET_GetFloatv(exec, _mesa_GetFloatv);
SET_GetString(exec, _mesa_GetString);
-   if (ctx-API != API_OPENGL_CORE) {
+   if (ctx-API == API_OPENGL) {
   SET_LineStipple(exec, _mesa_LineStipple);
}
SET_LineWidth(exec, _mesa_LineWidth);
@@ -197,13 +197,13 @@ _mesa_create_exec_table(struct gl_context *ctx)
}
SET_Viewport(exec, _mesa_Viewport);
 
-   if (ctx-API != API_OPENGL_CORE) {
+   if (ctx-API == API_OPENGL) {
   _mesa_init_accum_dispatch(exec);
   _mesa_init_dlist_dispatch(exec);
}
 
SET_ClearDepth(exec, _mesa_ClearDepth);
-   if (ctx-API != API_OPENGL_CORE) {
+   if (ctx-API == API_OPENGL) {
   SET_ClearIndex(exec, _mesa_ClearIndex);
   SET_ClipPlane(exec, _mesa_ClipPlane);
   SET_ColorMaterial(exec, _mesa_ColorMaterial);
@@ -213,9 +213,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_DepthRange(exec, _mesa_DepthRange);
 
_mesa_init_drawpix_dispatch(exec);
-   _mesa_init_feedback_dispatch(exec);
+   if (ctx-API == API_OPENGL) {
+  _mesa_init_feedback_dispatch(exec);
+   }
 
-   if (ctx-API != API_OPENGL_CORE) {
+   if (ctx-API == API_OPENGL) {
   SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
   SET_Fogf(exec, _mesa_Fogf);
   SET_Fogfv(exec, _mesa_Fogfv);
@@ -241,7 +243,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
SET_GetTexImage(exec, _mesa_GetTexImage);
SET_Hint(exec, _mesa_Hint);
-   if (ctx-API != API_OPENGL_CORE) {
+   if (ctx-API == API_OPENGL) {
   SET_IndexMask(exec, _mesa_IndexMask);
}
SET_IsEnabled(exec, _mesa_IsEnabled);
@@ -257,24 +259,22 @@ _mesa_create_exec_table(struct gl_context *ctx)
   SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
}
 
-   _mesa_init_eval_dispatch(exec);
-
-   if (ctx-API != API_OPENGL_CORE) {
+   if (ctx-API == API_OPENGL) {
+  _mesa_init_eval_dispatch(exec);
   SET_MultMatrixd(exec, _mesa_MultMatrixd);
+  _mesa_init_pixel_dispatch(exec);
}
 
-   _mesa_init_pixel_dispatch(exec);
-
SET_PixelStoref(exec, _mesa_PixelStoref);
SET_PointSize(exec, _mesa_PointSize);
SET_PolygonMode(exec, _mesa_PolygonMode);
SET_PolygonOffset(exec, _mesa_PolygonOffset);
-   if (ctx-API != API_OPENGL_CORE) {
+   if (ctx-API == API_OPENGL) {
   SET_PolygonStipple(exec, _mesa_PolygonStipple);
-   }
 
-   _mesa_init_attrib_dispatch(exec);
-   _mesa_init_rastpos_dispatch(exec);
+  _mesa_init_attrib_dispatch(exec);
+  _mesa_init_rastpos_dispatch(exec);
+   }
 
SET_ReadPixels(exec, _mesa_ReadPixels);
if (ctx-API != API_OPENGL_CORE) {
@@ -285,13 +285,15 @@ _mesa_create_exec_table(struct gl_context *ctx)
   SET_TexEnviv(exec, _mesa_TexEnviv);
}
 
-   _mesa_init_texgen_dispatch(exec);
+   if (ctx-API != API_OPENGL_CORE) {
+  _mesa_init_texgen_dispatch(exec);
+   }
 
SET_TexImage1D(exec, _mesa_TexImage1D);
SET_TexParameterf(exec, _mesa_TexParameterf);
SET_TexParameterfv(exec, _mesa_TexParameterfv);
SET_TexParameteriv(exec, _mesa_TexParameteriv);
-   if (ctx-API != API_OPENGL_CORE) {
+   if (ctx-API == API_OPENGL) {
   SET_Translated(exec, _mesa_Translated);
}
 
@@ -300,7 +302,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_DeleteTextures(exec, _mesa_DeleteTextures);
SET_GenTextures(exec, _mesa_GenTextures);
 #if _HAVE_FULL_GL
-   if (ctx-API != API_OPENGL_CORE) {
+   if (ctx-API == API_OPENGL) {
   SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
   SET_ColorPointer(exec, _mesa_ColorPointer);
}
@@ -341,9 +343,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_BlendEquation(exec, _mesa_BlendEquation);
SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
 
-   _mesa_init_colortable_dispatch(exec);
-   _mesa_init_convolve_dispatch(exec);
-   _mesa_init_histogram_dispatch(exec);
+   if (ctx-API == API_OPENGL) {
+  _mesa_init_colortable_dispatch(exec);
+  _mesa_init_convolve_dispatch(exec);
+  _mesa_init_histogram_dispatch(exec);
+   }
 
/* OpenGL 2.0 */
SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate);
@@ -362,7 +366,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
 
/* 3. GL_EXT_polygon_offset */
 #if _HAVE_FULL_GL
-   SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
+   if (ctx-API == API_OPENGL) {
+  SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
+   }
 #endif
 
/* 6. GL_EXT_texture3d */
@@ -374,7 +380,7 @@ 

[Mesa-dev] [PATCH 07/14] dri: Pass API_OPENGL_CORE through to the drivers

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

This forces the drivers to do at least some validation of context API
and version before creating the context.  In r100 and r200 drivers, this
means that they don't do any post-hoc validation.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/drivers/dri/common/dri_util.c |   15 +++
 src/mesa/drivers/dri/intel/intel_screen.c  |   17 +
 src/mesa/drivers/dri/nouveau/nouveau_context.c |   24 +++-
 src/mesa/drivers/dri/r200/r200_context.c   |   22 +++---
 src/mesa/drivers/dri/radeon/radeon_context.c   |   22 +++---
 src/mesa/drivers/dri/swrast/swrast.c   |   19 ++-
 6 files changed, 99 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index 91ae186..025a14a 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -192,6 +192,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
mesa_api = API_OPENGLES2;
break;
 case __DRI_API_OPENGL_CORE:
+mesa_api = API_OPENGL_CORE;
+break;
 default:
*error = __DRI_CTX_ERROR_BAD_API;
return NULL;
@@ -218,6 +220,19 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
}
 }
 
+/* Mesa does not support the GL_ARB_compatibilty extension or the
+ * compatibility profile.  This means that we treat a API_OPENGL 3.1 as
+ * API_OPENGL_CORE and reject API_OPENGL 3.2+.
+ */
+if (mesa_api == API_OPENGL  major_version == 3  minor_version == 1)
+   mesa_api = API_OPENGL_CORE;
+
+if (mesa_api == API_OPENGL
+ ((major_version  3)
+|| (major_version == 3  minor_version = 2))) {
+   mesa_api = API_OPENGL_CORE;
+}
+
 /* The EGL_KHR_create_context spec says:
  *
  * Flags are only defined for OpenGL context creation, and specifying
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 3c595bc..e541c7f 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -701,6 +701,23 @@ intelCreateContext(gl_api api,
struct intel_screen *intelScreen = sPriv-driverPrivate;
bool success = false;
 
+   switch (api) {
+   case API_OPENGL:
+   case API_OPENGLES:
+  break;
+   case API_OPENGLES2:
+#ifdef I915
+  if (!IS_9XX(intelScreen-deviceID)) {
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return false;
+  }
+#endif
+  break;
+   case API_OPENGL_CORE:
+  *error = __DRI_CTX_ERROR_BAD_API;
+  return GL_FALSE;
+   }
+
 #ifdef I915
if (IS_9XX(intelScreen-deviceID)) {
   if (!IS_965(intelScreen-deviceID)) {
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index f794308..4409eae 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -59,9 +59,31 @@ nouveau_context_create(gl_api api,
struct nouveau_context *nctx;
struct gl_context *ctx;
 
+   switch (api) {
+   case API_OPENGL:
+   /* Do after-the-fact version checking (below).
+*/
+   break;
+   case API_OPENGLES:
+   /* NV10 and NV20 can support OpenGL ES 1.0 only.  Older chips
+* cannot do even that.
+*/
+   if ((screen-device-chipset  0xf0) == 0x00) {
+   *error = __DRI_CTX_ERROR_BAD_API;
+   return GL_FALSE;
+   } else if (minor_version != 0) {
+   *error = __DRI_CTX_ERROR_BAD_VERSION;
+   return GL_FALSE;
+   }
+   break;
+   case API_OPENGLES2:
+   case API_OPENGL_CORE:
+   *error = __DRI_CTX_ERROR_BAD_API;
+   return GL_FALSE;
+   }
+
/* API and flag filtering is handled in dri2CreateContextAttribs.
 */
-   (void) api;
(void) flags;
 
ctx = screen-driver-context_create(screen, visual, share_ctx);
diff --git a/src/mesa/drivers/dri/r200/r200_context.c 
b/src/mesa/drivers/dri/r200/r200_context.c
index 17e08a1..5f8cc86 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -212,9 +212,22 @@ GLboolean r200CreateContext( gl_api api,
int i;
int tcl_mode;
 
-   /* API and flag filtering is handled in dri2CreateContextAttribs.
+   switch (api) {
+   case API_OPENGL:
+  if (major_version  1 || minor_version  3) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return GL_FALSE;
+  }
+  break;
+   case API_OPENGLES:
+  break;
+   default:
+  *error = __DRI_CTX_ERROR_BAD_API;
+  return GL_FALSE;
+   }
+
+   /* Flag filtering is handled in dri2CreateContextAttribs.
   

[Mesa-dev] [PATCH 08/14] intel: In the i915 driver, the chipset cannot be i965

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

In the i965 dirver, the chipset must be i965.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/drivers/dri/intel/intel_screen.c |   13 +
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index e541c7f..54ad112 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -720,20 +720,17 @@ intelCreateContext(gl_api api,
 
 #ifdef I915
if (IS_9XX(intelScreen-deviceID)) {
-  if (!IS_965(intelScreen-deviceID)) {
-success = i915CreateContext(api, mesaVis, driContextPriv,
-sharedContextPrivate);
-  }
+  success = i915CreateContext(api, mesaVis, driContextPriv,
+  sharedContextPrivate);
} else {
   intelScreen-no_vbo = true;
   success = i830CreateContext(mesaVis, driContextPriv,
  sharedContextPrivate);
}
 #else
-   if (IS_965(intelScreen-deviceID))
-  success = brwCreateContext(api, mesaVis,
- driContextPriv,
- sharedContextPrivate);
+   success = brwCreateContext(api, mesaVis,
+ driContextPriv,
+ sharedContextPrivate);
 #endif
 
if (success) {
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 09/14] i830: Validate API and version before calling i830CreateContext

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/drivers/dri/intel/intel_screen.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 54ad112..2fef8fe 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -723,9 +723,27 @@ intelCreateContext(gl_api api,
   success = i915CreateContext(api, mesaVis, driContextPriv,
   sharedContextPrivate);
} else {
+  switch (api) {
+  case API_OPENGL:
+ if (major_version  1 || minor_version  3) {
+*error = __DRI_CTX_ERROR_BAD_VERSION;
+return false;
+ }
+ break;
+  case API_OPENGLES:
+ break;
+  default:
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return false;
+  }
+
   intelScreen-no_vbo = true;
   success = i830CreateContext(mesaVis, driContextPriv,
  sharedContextPrivate);
+  if (!success) {
+ *error = __DRI_CTX_ERROR_NO_MEMORY;
+ return false;
+  }
}
 #else
success = brwCreateContext(api, mesaVis,
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 10/14] i915: Validate API and version in i915CreateContext

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/drivers/dri/i915/i915_context.c  |   35 -
 src/mesa/drivers/dri/i915/i915_context.h  |3 ++
 src/mesa/drivers/dri/intel/intel_screen.c |4 +++
 3 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i915_context.c 
b/src/mesa/drivers/dri/i915/i915_context.c
index dc32292..0729479 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -146,6 +146,9 @@ bool
 i915CreateContext(int api,
  const struct gl_config * mesaVis,
   __DRIcontext * driContextPriv,
+  unsigned major_version,
+  unsigned minor_version,
+  unsigned *error,
   void *sharedContextPrivate)
 {
struct dd_function_table functions;
@@ -153,8 +156,10 @@ i915CreateContext(int api,
struct intel_context *intel = i915-intel;
struct gl_context *ctx = intel-ctx;
 
-   if (!i915)
+   if (!i915) {
+  *error = __DRI_CTX_ERROR_NO_MEMORY;
   return false;
+   }
 
i915InitVtbl(i915);
 
@@ -163,6 +168,34 @@ i915CreateContext(int api,
if (!intelInitContext(intel, api, mesaVis, driContextPriv,
  sharedContextPrivate, functions)) {
   FREE(i915);
+  *error = __DRI_CTX_ERROR_NO_MEMORY;
+  return false;
+   }
+
+   /* Now that the extension bits are known, filter against the requested API
+* and version.
+*/
+   switch (api) {
+   case API_OPENGL: {
+  const unsigned max_version =
+ (ctx-Extensions.ARB_fragment_shader
+   ctx-Extensions.ARB_occlusion_query)
+ ? 0x200 : 0x105;
+  const unsigned req_version = (major_version  8) | minor_version;
+
+  if (req_version  max_version) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ FREE(i915);
+ return false;
+  }
+  break;
+   }
+   case API_OPENGLES:
+   case API_OPENGLES2:
+  break;
+   default:
+  *error = __DRI_CTX_ERROR_BAD_API;
+  FREE(i915);
   return false;
}
 
diff --git a/src/mesa/drivers/dri/i915/i915_context.h 
b/src/mesa/drivers/dri/i915/i915_context.h
index 7037465..f5c1596 100644
--- a/src/mesa/drivers/dri/i915/i915_context.h
+++ b/src/mesa/drivers/dri/i915/i915_context.h
@@ -322,6 +322,9 @@ do {
\
 extern bool i915CreateContext(int api,
  const struct gl_config * mesaVis,
  __DRIcontext * driContextPriv,
+  unsigned major_version,
+  unsigned minor_version,
+  unsigned *error,
  void *sharedContextPrivate);
 
 
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 2fef8fe..bc8c265 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -680,6 +680,9 @@ extern bool
 i915CreateContext(int api,
  const struct gl_config *mesaVis,
  __DRIcontext *driContextPriv,
+  unsigned major_version,
+  unsigned minor_version,
+  unsigned *error,
  void *sharedContextPrivate);
 extern bool
 brwCreateContext(int api,
@@ -721,6 +724,7 @@ intelCreateContext(gl_api api,
 #ifdef I915
if (IS_9XX(intelScreen-deviceID)) {
   success = i915CreateContext(api, mesaVis, driContextPriv,
+  major_version, minor_version, error,
   sharedContextPrivate);
} else {
   switch (api) {
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 11/14] i965: Validate API and version in brwCreateContext

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/drivers/dri/i965/brw_context.c   |   40 ++--
 src/mesa/drivers/dri/i965/brw_context.h   |3 ++
 src/mesa/drivers/dri/intel/intel_screen.c |8 -
 3 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index a5711e4..013ec14 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -75,27 +75,61 @@ bool
 brwCreateContext(int api,
 const struct gl_config *mesaVis,
 __DRIcontext *driContextPriv,
+ unsigned major_version,
+ unsigned minor_version,
+ unsigned *error,
 void *sharedContextPrivate)
 {
__DRIscreen *sPriv = driContextPriv-driScreenPriv;
struct intel_screen *screen = sPriv-driverPrivate;
struct dd_function_table functions;
-   struct brw_context *brw = rzalloc(NULL, struct brw_context);
-   struct intel_context *intel = brw-intel;
-   struct gl_context *ctx = intel-ctx;
unsigned i;
 
+   /* Filter against the requested API and version.
+*/
+   switch (api) {
+   case API_OPENGL: {
+#ifdef TEXTURE_FLOAT_ENABLED
+  const unsigned max_version =
+ (screen-gen == 6 ||
+  (screen-gen == 7  screen-kernel_has_gen7_sol_reset))
+ ? 0x300 : 0x201;
+#else
+  const unsigned max_version = 0x201;
+#endif
+  const unsigned req_version = (major_version  8) | minor_version;
+
+  if (req_version  max_version) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return false;
+  }
+  break;
+   }
+   case API_OPENGLES:
+   case API_OPENGLES2:
+  break;
+   default:
+  *error = __DRI_CTX_ERROR_BAD_API;
+  return false;
+   }
+
+   struct brw_context *brw = rzalloc(NULL, struct brw_context);
if (!brw) {
   printf(%s: failed to alloc context\n, __FUNCTION__);
+  *error = __DRI_CTX_ERROR_NO_MEMORY;
   return false;
}
 
brwInitDriverFunctions(screen, functions);
 
+   struct intel_context *intel = brw-intel;
+   struct gl_context *ctx = intel-ctx;
+
if (!intelInitContext( intel, api, mesaVis, driContextPriv,
  sharedContextPrivate, functions )) {
   printf(%s: failed to init intel context\n, __FUNCTION__);
   FREE(brw);
+  *error = __DRI_CTX_ERROR_NO_MEMORY;
   return false;
}
 
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 1548f81..77d88ea 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1097,6 +1097,9 @@ void brwInitVtbl( struct brw_context *brw );
 bool brwCreateContext(int api,
  const struct gl_config *mesaVis,
  __DRIcontext *driContextPriv,
+  unsigned major_version,
+  unsigned minor_version,
+  unsigned *error,
  void *sharedContextPrivate);
 
 /*==
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index bc8c265..26b3732 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -688,6 +688,9 @@ extern bool
 brwCreateContext(int api,
 const struct gl_config *mesaVis,
 __DRIcontext *driContextPriv,
+ unsigned major_version,
+ unsigned minor_version,
+ unsigned *error,
 void *sharedContextPrivate);
 
 static GLboolean
@@ -751,8 +754,9 @@ intelCreateContext(gl_api api,
}
 #else
success = brwCreateContext(api, mesaVis,
- driContextPriv,
- sharedContextPrivate);
+  driContextPriv,
+  major_version, minor_version, error,
+  sharedContextPrivate);
 #endif
 
if (success) {
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 12/14] intel: Clean up bits of cruft in intelCreateContext

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

This and the previous three commits should probably be squashed together...

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/drivers/dri/intel/intel_screen.c |   51 ++--
 1 files changed, 11 insertions(+), 40 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 26b3732..30d24cc 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -707,23 +707,6 @@ intelCreateContext(gl_api api,
struct intel_screen *intelScreen = sPriv-driverPrivate;
bool success = false;
 
-   switch (api) {
-   case API_OPENGL:
-   case API_OPENGLES:
-  break;
-   case API_OPENGLES2:
-#ifdef I915
-  if (!IS_9XX(intelScreen-deviceID)) {
- *error = __DRI_CTX_ERROR_BAD_API;
- return false;
-  }
-#endif
-  break;
-   case API_OPENGL_CORE:
-  *error = __DRI_CTX_ERROR_BAD_API;
-  return GL_FALSE;
-   }
-
 #ifdef I915
if (IS_9XX(intelScreen-deviceID)) {
   success = i915CreateContext(api, mesaVis, driContextPriv,
@@ -734,22 +717,22 @@ intelCreateContext(gl_api api,
   case API_OPENGL:
  if (major_version  1 || minor_version  3) {
 *error = __DRI_CTX_ERROR_BAD_VERSION;
-return false;
+success = false;
  }
  break;
   case API_OPENGLES:
  break;
   default:
  *error = __DRI_CTX_ERROR_BAD_API;
- return false;
+ success = false;
   }
 
-  intelScreen-no_vbo = true;
-  success = i830CreateContext(mesaVis, driContextPriv,
- sharedContextPrivate);
-  if (!success) {
- *error = __DRI_CTX_ERROR_NO_MEMORY;
- return false;
+  if (success) {
+ intelScreen-no_vbo = true;
+ success = i830CreateContext(mesaVis, driContextPriv,
+ sharedContextPrivate);
+ if (!success)
+*error = __DRI_CTX_ERROR_NO_MEMORY;
   }
}
 #else
@@ -759,22 +742,10 @@ intelCreateContext(gl_api api,
   sharedContextPrivate);
 #endif
 
-   if (success) {
-  struct gl_context *ctx =
-(struct gl_context *) driContextPriv-driverPrivate;
-
-  _mesa_compute_version(ctx);
-  if (ctx-Version = major_version * 10 + minor_version) {
-return true;
-  }
-
-  *error = __DRI_CTX_ERROR_BAD_VERSION;
-  intelDestroyContext(driContextPriv);
-   } else {
-  *error = __DRI_CTX_ERROR_NO_MEMORY;
-  fprintf(stderr, Unrecognized deviceID 0x%x\n, intelScreen-deviceID);
-   }
+   if (success)
+  return true;
 
+   intelDestroyContext(driContextPriv);
return false;
 }
 
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 13/14] i965: Advertise GLSL 1.40 and TexBOs in core contexts

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/drivers/dri/intel/intel_extensions.c |   10 +-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index 76b56a2..10e664b 100755
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -93,7 +93,11 @@ intelInitExtensions(struct gl_context *ctx)
ctx-Extensions.OES_compressed_ETC1_RGB8_texture = true;
 
if (intel-gen = 6)
-  ctx-Const.GLSLVersion = 130;
+  if (ctx-API == API_OPENGL_CORE) {
+ ctx-Const.GLSLVersion = 140;
+  } else {
+ ctx-Const.GLSLVersion = 130;
+  }
else
   ctx-Const.GLSLVersion = 120;
_mesa_override_glsl_version(ctx);
@@ -106,6 +110,10 @@ intelInitExtensions(struct gl_context *ctx)
   ctx-Extensions.ARB_blend_func_extended = 
!driQueryOptionb(intel-optionCache, disable_blend_func_extended);
   ctx-Extensions.ARB_draw_buffers_blend = true;
   ctx-Extensions.ARB_uniform_buffer_object = true;
+
+  if (ctx-API == API_OPENGL_CORE) {
+ ctx-Extensions.ARB_texture_buffer_object = true;
+  }
}
 
if (intel-gen = 5)
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 14/14] i965: Allow creation of OpenGL 3.1 contexts

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/drivers/dri/i965/brw_context.c |   19 +++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 013ec14..990b467 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -108,6 +108,25 @@ brwCreateContext(int api,
case API_OPENGLES:
case API_OPENGLES2:
   break;
+   case API_OPENGL_CORE: {
+#ifdef TEXTURE_FLOAT_ENABLED
+  const unsigned max_version =
+ (screen-gen == 6 ||
+  (screen-gen == 7  screen-kernel_has_gen7_sol_reset))
+ ? 0x301 : 0;
+#else
+  const unsigned max_version = 0;
+#endif
+  const unsigned req_version = (major_version  8) | minor_version;
+
+  if (req_version  max_version) {
+ *error = (max_version == 0)
+? __DRI_CTX_ERROR_BAD_API : __DRI_CTX_ERROR_BAD_VERSION;
+ return false;
+  }
+
+  break;
+   }
default:
   *error = __DRI_CTX_ERROR_BAD_API;
   return false;
-- 
1.7.6.5

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


[Mesa-dev] [PATCH] intel: use _mesa_meta_Clear with OpenGL ES 1.1 v2

2012-08-08 Thread Tapani Pälli
Patch changes i915 and i965 drivers to use fixed function version of
meta clear when running on ES 1.1. This fixes rendering errors seen with
Google Maps, Angry Birds and Gallery3D on Android platform.

Change 88128516d43be5d25288ff5b64db63cda83c04b3 exposes all extensions
internally to be available independent of GL flavour, therefore check
against ARB_fragment_shader does not work.

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50333
---
 src/mesa/drivers/dri/i915/intel_clear.c | 6 +++---
 src/mesa/drivers/dri/i965/brw_clear.c   | 7 ++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_clear.c 
b/src/mesa/drivers/dri/i915/intel_clear.c
index 96d9c8f..ebac0f5 100644
--- a/src/mesa/drivers/dri/i915/intel_clear.c
+++ b/src/mesa/drivers/dri/i915/intel_clear.c
@@ -179,10 +179,10 @@ intelClear(struct gl_context *ctx, GLbitfield mask)
 
if (tri_mask) {
   debug_mask(tri, tri_mask);
-  if (ctx-Extensions.ARB_fragment_shader)
-_mesa_meta_glsl_Clear(intel-ctx, tri_mask);
-  else
+  if (ctx-API == API_OPENGLES)
 _mesa_meta_Clear(intel-ctx, tri_mask);
+  else
+_mesa_meta_glsl_Clear(intel-ctx, tri_mask);
}
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_clear.c 
b/src/mesa/drivers/dri/i965/brw_clear.c
index 31c2e45..81b7a12 100644
--- a/src/mesa/drivers/dri/i965/brw_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_clear.c
@@ -226,7 +226,12 @@ brw_clear(struct gl_context *ctx, GLbitfield mask)
if (tri_mask) {
   debug_mask(tri, tri_mask);
   mask = ~tri_mask;
-  _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
+
+  if(ctx-API == API_OPENGLES) {
+ _mesa_meta_Clear(intel-ctx, tri_mask);
+  } else {
+ _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
+  }
}
 
/* Any strange buffers get passed off to swrast */
-- 
1.7.11.2

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


Re: [Mesa-dev] [PATCH 04/14] mesa: Don't advertise extensions that are part of GL 1.4 in a core context

2012-08-08 Thread Brian Paul

On 08/08/2012 11:38 AM, Ian Romanick wrote:

From: Ian Romanickian.d.roman...@intel.com

Signed-off-by: Ian Romanickian.d.roman...@intel.com
---
  src/mesa/main/extensions.c |   24 
  1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 5115d42..cca1eac 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -88,7 +88,7 @@ static const struct extension extension_table[] = {
 { GL_ARB_debug_output,o(dummy_true), 
 GL, 2009 },
 { GL_ARB_depth_buffer_float,  o(ARB_depth_buffer_float), 
 GL, 2008 },
 { GL_ARB_depth_clamp, o(ARB_depth_clamp),
 GL, 2003 },
-   { GL_ARB_depth_texture,   o(ARB_depth_texture),   
GL, 2001 },
+   { GL_ARB_depth_texture,   o(ARB_depth_texture),   
GLL,2001 },
 { GL_ARB_draw_buffers,o(dummy_true), 
 GL, 2002 },
 { GL_ARB_draw_buffers_blend,  o(ARB_draw_buffers_blend), 
 GL, 2009 },
 { GL_ARB_draw_elements_base_vertex,   
o(ARB_draw_elements_base_vertex),   GL, 2009 },
@@ -109,7 +109,7 @@ static const struct extension extension_table[] = {
 { GL_ARB_occlusion_query2,o(ARB_occlusion_query2),   
 GL, 2003 },
 { GL_ARB_occlusion_query, o(ARB_occlusion_query),
 GL, 2001 },
 { GL_ARB_pixel_buffer_object, 
o(EXT_pixel_buffer_object), GL, 2004 },
-   { GL_ARB_point_parameters,o(EXT_point_parameters),
GL, 1997 },
+   { GL_ARB_point_parameters,o(EXT_point_parameters),
GLL,1997 },
 { GL_ARB_point_sprite,o(ARB_point_sprite),   
 GL, 2003 },
 { GL_ARB_provoking_vertex,o(EXT_provoking_vertex),   
 GL, 2009 },
 { GL_ARB_robustness,  o(dummy_true), 
 GL, 2010 },
@@ -121,7 +121,7 @@ static const struct extension extension_table[] = {
 { GL_ARB_shader_texture_lod,  o(ARB_shader_texture_lod), 
 GL, 2009 },
 { GL_ARB_shading_language_100,
o(ARB_shading_language_100),GLL,2003 },
 { GL_ARB_shadow_ambient,  o(ARB_shadow_ambient), 
 GL, 2001 },


I think GL_ARB_shadow_ambient would go hand-in-hand with GL_ARB_shadow.


Otherwise patches 1-6 look good to me.  We'll probably make more 
tweaks in the future.


Reviewed-by: Brian Paul bri...@vmware.com

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


[Mesa-dev] [PATCH 01/10] dri_util: Compare against the correct API enums

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/drivers/dri/common/dri_util.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index 025a14a..9f031f5 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -243,8 +243,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
  * anything specific about this case.  However, none of the known flags
  * have any meaning in an ES context, so this seems safe.
  */
-if (mesa_api != __DRI_API_OPENGL
- mesa_api != __DRI_API_OPENGL_CORE
+if (mesa_api != API_OPENGL
+ mesa_api != API_OPENGL_CORE
  flags != 0) {
*error = __DRI_CTX_ERROR_BAD_FLAG;
return NULL;
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 02/10] egl_dri2: Require DRI2 version 2

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

The extra block in dri2_create_context is to prevent extra white space noise
in the next patch.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/egl/drivers/dri2/egl_dri2.c |   27 +--
 1 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a78ee8b..cc37bf0 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -308,7 +308,7 @@ struct dri2_extension_match {
 
 static struct dri2_extension_match dri2_driver_extensions[] = {
{ __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) },
-   { __DRI_DRI2, 1, offsetof(struct dri2_egl_display, dri2) },
+   { __DRI_DRI2, 2, offsetof(struct dri2_egl_display, dri2) },
{ NULL, 0, 0 }
 };
 
@@ -464,10 +464,7 @@ dri2_setup_screen(_EGLDisplay *disp)
unsigned int api_mask;
 
if (dri2_dpy-dri2) {
-  if (dri2_dpy-dri2-base.version = 2)
- api_mask = dri2_dpy-dri2-getAPIMask(dri2_dpy-dri_screen);
-  else
- api_mask = 1  __DRI_API_OPENGL;
+  api_mask = dri2_dpy-dri2-getAPIMask(dri2_dpy-dri_screen);
} else {
   assert(dri2_dpy-swrast);
   api_mask = 1  __DRI_API_OPENGL | 1  __DRI_API_GLES | 1  
__DRI_API_GLES2;
@@ -481,14 +478,8 @@ dri2_setup_screen(_EGLDisplay *disp)
if (api_mask  (1  __DRI_API_GLES2))
   disp-ClientAPIs |= EGL_OPENGL_ES2_BIT;
 
-   if (dri2_dpy-dri2) {
-  if (dri2_dpy-dri2-base.version = 2) {
- disp-Extensions.KHR_surfaceless_context = EGL_TRUE;
-  }
-   } else {
-  assert(dri2_dpy-swrast);
-  disp-Extensions.KHR_surfaceless_context = EGL_TRUE;
-   }
+   assert(dri2_dpy-dri2 || dri2_dpy-swrast);
+   disp-Extensions.KHR_surfaceless_context = EGL_TRUE;
 
if (dri2_dpy-image) {
   disp-Extensions.MESA_drm_image = EGL_TRUE;
@@ -706,21 +697,13 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
   dri_config = NULL;
 
if (dri2_dpy-dri2) {
-  if (dri2_dpy-dri2-base.version = 2) {
+  {
 dri2_ctx-dri_context =
dri2_dpy-dri2-createNewContextForAPI(dri2_dpy-dri_screen,
   api,
   dri_config,
shared,
   dri2_ctx);
-  } else if (api == __DRI_API_OPENGL) {
-dri2_ctx-dri_context =
-   dri2_dpy-dri2-createNewContext(dri2_dpy-dri_screen,
-dri_config,
- shared,
-dri2_ctx);
-  } else {
-/* fail */
   }
} else {
   assert(dri2_dpy-swrast);
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 03/10] egl_dri2: Use createContextAttribs if DRI2 version = 3

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/egl/drivers/dri2/egl_dri2.c |   18 +-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index cc37bf0..3bf46aa 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -697,7 +697,23 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
   dri_config = NULL;
 
if (dri2_dpy-dri2) {
-  {
+  if (dri2_dpy-dri2-base.version = 3) {
+ unsigned error;
+ const uint32_t ctx_attribs[2] = {
+__DRI_CTX_ATTRIB_MAJOR_VERSION,
+dri2_ctx-base.ClientVersion
+ };
+
+dri2_ctx-dri_context =
+   dri2_dpy-dri2-createContextAttribs(dri2_dpy-dri_screen,
+ api,
+ dri_config,
+ shared,
+ 1,
+ ctx_attribs,
+  error,
+ dri2_ctx);
+  } else {
 dri2_ctx-dri_context =
dri2_dpy-dri2-createNewContextForAPI(dri2_dpy-dri_screen,
   api,
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 04/10] egl: Rename ClientVersion to ClientMajorVersion, add ClientMinorVersion

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/egl/drivers/dri2/egl_dri2.c |4 ++--
 src/egl/main/eglcontext.c   |9 +
 src/egl/main/eglcontext.h   |3 ++-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 3bf46aa..4cd2d13 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -654,7 +654,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
 
switch (dri2_ctx-base.ClientAPI) {
case EGL_OPENGL_ES_API:
-  switch (dri2_ctx-base.ClientVersion) {
+  switch (dri2_ctx-base.ClientMajorVersion) {
   case 1:
  api = __DRI_API_GLES;
  break;
@@ -701,7 +701,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
  unsigned error;
  const uint32_t ctx_attribs[2] = {
 __DRI_CTX_ATTRIB_MAJOR_VERSION,
-dri2_ctx-base.ClientVersion
+dri2_ctx-base.ClientMajorVersion
  };
 
 dri2_ctx-dri_context =
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index fa60749..55d6865 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -49,7 +49,7 @@ _eglGetContextAPIBit(_EGLContext *ctx)
 
switch (ctx-ClientAPI) {
case EGL_OPENGL_ES_API:
-  switch (ctx-ClientVersion) {
+  switch (ctx-ClientMajorVersion) {
   case 1:
  bit = EGL_OPENGL_ES_BIT;
  break;
@@ -100,7 +100,7 @@ _eglParseContextAttribList(_EGLContext *ctx, const EGLint 
*attrib_list)
 err = EGL_BAD_ATTRIBUTE;
 break;
  }
- ctx-ClientVersion = val;
+ ctx-ClientMajorVersion = val;
  break;
   default:
  err = EGL_BAD_ATTRIBUTE;
@@ -138,7 +138,8 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, 
_EGLConfig *conf,
ctx-Config = conf;
ctx-WindowRenderBuffer = EGL_NONE;
 
-   ctx-ClientVersion = 1; /* the default, per EGL spec */
+   ctx-ClientMajorVersion = 1; /* the default, per EGL spec */
+   ctx-ClientMinorVersion = 0;
 
err = _eglParseContextAttribList(ctx, attrib_list);
if (err == EGL_SUCCESS  ctx-Config) {
@@ -191,7 +192,7 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLContext *c,
   *value = c-Config-ConfigID;
   break;
case EGL_CONTEXT_CLIENT_VERSION:
-  *value = c-ClientVersion;
+  *value = c-ClientMajorVersion;
   break;
case EGL_CONTEXT_CLIENT_TYPE:
   *value = c-ClientAPI;
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index 0ac8462..5e86cec 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -52,7 +52,8 @@ struct _egl_context
_EGLConfig *Config;
 
EGLint ClientAPI; /** EGL_OPENGL_ES_API, EGL_OPENGL_API, EGL_OPENVG_API */
-   EGLint ClientVersion; /** 1 = OpenGLES 1.x, 2 = OpenGLES 2.x */
+   EGLint ClientMajorVersion;
+   EGLint ClientMinorVersion;
 
/* The real render buffer when a window surface is bound */
EGLint WindowRenderBuffer;
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 05/10] egl_dri2: Silence warnings about missing initializers

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

egl_dri2.c: At top level:
egl_dri2.c:325:4: warning: missing initializer [-Wmissing-field-initializers]
egl_dri2.c:325:4: warning: (near initialization for 
'swrast_driver_extensions[2].version') [-Wmissing-field-initializers]
egl_dri2.c:330:4: warning: missing initializer [-Wmissing-field-initializers]
egl_dri2.c:330:4: warning: (near initialization for 
'swrast_core_extensions[1].version') [-Wmissing-field-initializers]

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/egl/drivers/dri2/egl_dri2.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 4cd2d13..4cd19a1 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -322,12 +322,12 @@ static struct dri2_extension_match dri2_core_extensions[] 
= {
 static struct dri2_extension_match swrast_driver_extensions[] = {
{ __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) },
{ __DRI_SWRAST, 2, offsetof(struct dri2_egl_display, swrast) },
-   { NULL }
+   { NULL, 0, 0 }
 };
 
 static struct dri2_extension_match swrast_core_extensions[] = {
{ __DRI_TEX_BUFFER, 2, offsetof(struct dri2_egl_display, tex_buffer) },
-   { NULL }
+   { NULL, 0, 0 }
 };
 
 static EGLBoolean
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 06/10] egl: Implement front-end support for EGL_KHR_create_context

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/egl/main/eglcontext.c |  217 +++-
 src/egl/main/eglcontext.h |3 +
 src/egl/main/egldisplay.h |1 +
 src/egl/main/eglmisc.c|1 +
 4 files changed, 217 insertions(+), 5 deletions(-)

diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 55d6865..c9a9948 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -78,7 +78,8 @@ _eglGetContextAPIBit(_EGLContext *ctx)
  * Parse the list of context attributes and return the proper error code.
  */
 static EGLint
-_eglParseContextAttribList(_EGLContext *ctx, const EGLint *attrib_list)
+_eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
+   const EGLint *attrib_list)
 {
EGLenum api = ctx-ClientAPI;
EGLint i, err = EGL_SUCCESS;
@@ -86,22 +87,88 @@ _eglParseContextAttribList(_EGLContext *ctx, const EGLint 
*attrib_list)
if (!attrib_list)
   return EGL_SUCCESS;
 
+   if (api == EGL_OPENVG_API  attrib_list[0] != EGL_NONE) {
+  _eglLog(_EGL_DEBUG, bad context attribute 0x%04x, attrib_list[0]);
+  return EGL_BAD_ATTRIBUTE;
+   }
+
for (i = 0; attrib_list[i] != EGL_NONE; i++) {
   EGLint attr = attrib_list[i++];
   EGLint val = attrib_list[i];
 
   switch (attr) {
   case EGL_CONTEXT_CLIENT_VERSION:
- if (api != EGL_OPENGL_ES_API) {
+ ctx-ClientMajorVersion = val;
+ break;
+
+  case EGL_CONTEXT_MINOR_VERSION_KHR:
+ if (!dpy-Extensions.KHR_create_context) {
 err = EGL_BAD_ATTRIBUTE;
 break;
  }
- if (val != 1  val != 2) {
+
+ ctx-ClientMinorVersion = val;
+ break;
+
+  case EGL_CONTEXT_FLAGS_KHR:
+ if (!dpy-Extensions.KHR_create_context) {
 err = EGL_BAD_ATTRIBUTE;
 break;
  }
- ctx-ClientMajorVersion = val;
+
+ /* The EGL_KHR_create_context spec says:
+  *
+  * Flags are only defined for OpenGL context creation, and
+  * specifying a flags value other than zero for other types of
+  * contexts, including OpenGL ES contexts, will generate an
+  * error.
+  */
+ if (api != EGL_OPENGL_API  val != 0) {
+err = EGL_BAD_ATTRIBUTE;
+break;
+ }
+
+ ctx-Flags = val;
  break;
+
+  case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
+ if (!dpy-Extensions.KHR_create_context) {
+err = EGL_BAD_ATTRIBUTE;
+break;
+ }
+
+ /* The EGL_KHR_create_context spec says:
+  *
+  * [EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR] is only meaningful for
+  * OpenGL contexts, and specifying it for other types of
+  * contexts, including OpenGL ES contexts, will generate an
+  * error.
+  */
+ if (api != EGL_OPENGL_API) {
+err = EGL_BAD_ATTRIBUTE;
+break;
+ }
+
+ ctx-Profile = val;
+ break;
+
+  case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
+ /* The EGL_KHR_create_context spec says:
+  *
+  * [EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR] is only
+  * meaningful for OpenGL contexts, and specifying it for other
+  * types of contexts, including OpenGL ES contexts, will generate
+  * an error.
+  */
+   if (!dpy-Extensions.KHR_create_context
+   || api != EGL_OPENGL_API) {
+err = EGL_BAD_ATTRIBUTE;
+break;
+ }
+
+ ctx-ResetNotificationStrategy = val;
+ break;
+
   default:
  err = EGL_BAD_ATTRIBUTE;
  break;
@@ -113,6 +180,142 @@ _eglParseContextAttribList(_EGLContext *ctx, const EGLint 
*attrib_list)
   }
}
 
+   if (api == EGL_OPENGL_API) {
+  /* The EGL_KHR_create_context spec says:
+   *
+   * If the requested OpenGL version is less than 3.2,
+   * EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR is ignored and the
+   * functionality of the context is determined solely by the
+   * requested version.
+   *
+   * Since the value is ignored, only validate the setting if the version
+   * is = 3.2.
+   */
+  if (ctx-ClientMajorVersion = 4
+  || (ctx-ClientMajorVersion == 3  ctx-ClientMinorVersion = 2)) {
+ switch (ctx-Profile) {
+ case EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR:
+ case EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR:
+break;
+
+ default:
+/* The EGL_KHR_create_context spec says:
+ *
+ * * If an OpenGL context is requested, the requested version
+ *is greater than 3.2, and the value for attribute
+ *EGL_CONTEXT_PROFILE_MASK_KHR has no bits 

[Mesa-dev] [PATCH 07/10] egl: Implement front-end support for EGL_EXT_create_context_robustness

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/egl/main/eglcontext.c |   25 +
 src/egl/main/egldisplay.h |2 ++
 src/egl/main/eglmisc.c|2 ++
 3 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index c9a9948..cb50de7 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -169,6 +169,31 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay 
*dpy,
  ctx-ResetNotificationStrategy = val;
  break;
 
+  case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
+ /* The EGL_EXT_create_context_robustness spec says:
+  *
+  * [EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT] is only
+  * meaningful for OpenGL ES contexts, and specifying it for other
+  * types of contexts will generate an EGL_BAD_ATTRIBUTE error.
+  */
+ if (!dpy-Extensions.EXT_create_context_robustness
+ || api != EGL_OPENGL_ES_API) {
+err = EGL_BAD_ATTRIBUTE;
+break;
+ }
+
+ ctx-ResetNotificationStrategy = val;
+ break;
+
+  case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
+ if (!dpy-Extensions.EXT_create_context_robustness) {
+err = EGL_BAD_ATTRIBUTE;
+break;
+ }
+
+ ctx-Flags = EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
+ break;
+
   default:
  err = EGL_BAD_ATTRIBUTE;
  break;
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index ba62941..ccb1fbc 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -112,6 +112,8 @@ struct _egl_extensions
EGLBoolean ANDROID_image_native_buffer;
 
EGLBoolean NV_post_sub_buffer;
+
+   EGLBoolean EXT_create_context_robustness;
 };
 
 
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index 1f7d9a0..b7599d0 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -115,6 +115,8 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
 
_EGL_CHECK_EXTENSION(ANDROID_image_native_buffer);
 
+   _EGL_CHECK_EXTENSION(EXT_create_context_robustness);
+
_EGL_CHECK_EXTENSION(NV_post_sub_buffer);
 #undef _EGL_CHECK_EXTENSION
 }
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 08/10] egl_dri2: Add support for EGL_KHR_create_context and EGL_EXT_create_context_robustness

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Just like in GLX, EGL_KHR_create_context requires DRI2 version = 3, and
EGL_EXT_create_context_robustness requires both DRI2 version = 3 and the
__DRI2_ROBUSTNESS extension.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/egl/drivers/dri2/egl_dri2.c |   67 +++---
 src/egl/drivers/dri2/egl_dri2.h |1 +
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 4cd19a1..c3068c3 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -481,6 +481,13 @@ dri2_setup_screen(_EGLDisplay *disp)
assert(dri2_dpy-dri2 || dri2_dpy-swrast);
disp-Extensions.KHR_surfaceless_context = EGL_TRUE;
 
+   if (dri2_dpy-dri2-base.version = 3) {
+  disp-Extensions.KHR_create_context = EGL_TRUE;
+
+  if (dri2_dpy-robustness)
+ disp-Extensions.EXT_create_context_robustness = EGL_TRUE;
+   }
+
if (dri2_dpy-image) {
   disp-Extensions.MESA_drm_image = EGL_TRUE;
   disp-Extensions.KHR_image_base = EGL_TRUE;
@@ -517,8 +524,16 @@ dri2_create_screen(_EGLDisplay *disp)
extensions = dri2_dpy-core-getExtensions(dri2_dpy-dri_screen);

if (dri2_dpy-dri2) {
+  unsigned i;
+
   if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions))
  goto cleanup_dri_screen;
+
+  for (i = 0; extensions[i]; i++) {
+if (strcmp(extensions[i]-name, __DRI2_ROBUSTNESS) == 0) {
+dri2_dpy-robustness = (__DRIrobustnessExtension *) extensions[i];
+}
+  }
} else {
   assert(dri2_dpy-swrast);
   if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions, extensions))
@@ -667,7 +682,13 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
   }
   break;
case EGL_OPENGL_API:
-  api = __DRI_API_OPENGL;
+  if ((dri2_ctx-base.ClientMajorVersion = 4
+   || (dri2_ctx-base.ClientMajorVersion == 3
+dri2_ctx-base.ClientMinorVersion = 2))
+   dri2_ctx-base.Profile == EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR)
+ api = __DRI_API_OPENGL_CORE;
+  else
+ api = __DRI_API_OPENGL;
   break;
default:
   _eglError(EGL_BAD_PARAMETER, eglCreateContext);
@@ -699,17 +720,51 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
if (dri2_dpy-dri2) {
   if (dri2_dpy-dri2-base.version = 3) {
  unsigned error;
- const uint32_t ctx_attribs[2] = {
-__DRI_CTX_ATTRIB_MAJOR_VERSION,
-dri2_ctx-base.ClientMajorVersion
- };
+ unsigned num_attribs = 0;
+ uint32_t ctx_attribs[8];
+
+ ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
+ ctx_attribs[num_attribs++] = dri2_ctx-base.ClientMajorVersion;
+ ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
+ ctx_attribs[num_attribs++] = dri2_ctx-base.ClientMinorVersion;
+
+ if (dri2_ctx-base.Flags != 0) {
+/* If the implementation doesn't support the __DRI2_ROBUSTNESS
+ * extension, don't even try to send it the robust-access flag.
+ * It may explode.  Instead, generate the required EGL error here.
+ */
+if ((dri2_ctx-base.Flags  
EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) != 0
+ !dri2_dpy-robustness) {
+   _eglError(EGL_BAD_MATCH, eglCreateContext);
+   goto cleanup;
+}
+
+ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
+ctx_attribs[num_attribs++] = dri2_ctx-base.Flags;
+ }
+
+ if (dri2_ctx-base.ResetNotificationStrategy != 
EGL_NO_RESET_NOTIFICATION_KHR) {
+/* If the implementation doesn't support the __DRI2_ROBUSTNESS
+ * extension, don't even try to send it a reset strategy.  It may
+ * explode.  Instead, generate the required EGL error here.
+ */
+if (!dri2_dpy-robustness) {
+   _eglError(EGL_BAD_CONFIG, eglCreateContext);
+   goto cleanup;
+}
+
+ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_RESET_STRATEGY;
+ctx_attribs[num_attribs++] = __DRI_CTX_RESET_LOSE_CONTEXT;
+ }
+
+ assert(num_attribs = ARRAY_SIZE(ctx_attribs));
 
 dri2_ctx-dri_context =
dri2_dpy-dri2-createContextAttribs(dri2_dpy-dri_screen,
  api,
  dri_config,
  shared,
- 1,
+ num_attribs / 2,
  ctx_attribs,
   error,
  dri2_ctx);
diff 

[Mesa-dev] [PATCH 09/10] dri2: Note that __DRI_API_GLES2 is also used for OpenGL ES 3.0

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Unlike 1.x to 2.0, OpenGL ES 3.0 is backwards compatible with 2.0.  Use the
same API flag for both.  Applications that specifically want 3.0 will specify
this using the major / minor version attributes.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 include/GL/internal/dri_interface.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index d3a66c5..97e1a1a 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -800,8 +800,8 @@ struct __DRIdri2LoaderExtensionRec {
 #define __DRI_DRI2_VERSION 3
 
 #define __DRI_API_OPENGL   0   /** OpenGL compatibility profile */
-#define __DRI_API_GLES 1
-#define __DRI_API_GLES22
+#define __DRI_API_GLES 1   /** OpenGL ES 1.x */
+#define __DRI_API_GLES22   /** OpenGL ES 2.0 or 3.0 */
 #define __DRI_API_OPENGL_CORE  3   /** OpenGL 3.2+ core profile */
 
 #define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 10/10] egl: Allow OpenGL ES 3.0 as a version

2012-08-08 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

In the DRI2 back-end this will get the same API as GLES 2.0.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/egl/drivers/dri2/egl_dri2.c |1 +
 src/egl/main/eglcontext.c   |8 +++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index c3068c3..423d18d 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -674,6 +674,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLConfig *conf,
  api = __DRI_API_GLES;
  break;
   case 2:
+  case 3:
  api = __DRI_API_GLES2;
  break;
   default:
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index cb50de7..829050d 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -54,6 +54,7 @@ _eglGetContextAPIBit(_EGLContext *ctx)
  bit = EGL_OPENGL_ES_BIT;
  break;
   case 2:
+  case 3:
  bit = EGL_OPENGL_ES2_BIT;
  break;
   default:
@@ -317,9 +318,14 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay 
*dpy,
  break;
 
   case 2:
+ if (ctx-ClientMinorVersion  0)
+err = EGL_BAD_MATCH;
+ break;
+
+  case 3:
   default:
  /* Don't put additional version checks here.  We don't know that
-  * there won't be versions  2.0.
+  * there won't be versions  3.0.
   */
  break;
   }
-- 
1.7.6.5

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


Re: [Mesa-dev] [PATCH 07/14] dri: Pass API_OPENGL_CORE through to the drivers

2012-08-08 Thread Jordan Justen
On Wed, Aug 8, 2012 at 10:38 AM, Ian Romanick i...@freedesktop.org wrote:
 From: Ian Romanick ian.d.roman...@intel.com

 This forces the drivers to do at least some validation of context API
 and version before creating the context.  In r100 and r200 drivers, this
 means that they don't do any post-hoc validation.

 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  src/mesa/drivers/dri/common/dri_util.c |   15 +++
  src/mesa/drivers/dri/intel/intel_screen.c  |   17 +
  src/mesa/drivers/dri/nouveau/nouveau_context.c |   24 
 +++-
  src/mesa/drivers/dri/r200/r200_context.c   |   22 +++---
  src/mesa/drivers/dri/radeon/radeon_context.c   |   22 +++---
  src/mesa/drivers/dri/swrast/swrast.c   |   19 ++-
  6 files changed, 99 insertions(+), 20 deletions(-)

 diff --git a/src/mesa/drivers/dri/common/dri_util.c 
 b/src/mesa/drivers/dri/common/dri_util.c
 index 91ae186..025a14a 100644
 --- a/src/mesa/drivers/dri/common/dri_util.c
 +++ b/src/mesa/drivers/dri/common/dri_util.c
 @@ -192,6 +192,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
 mesa_api = API_OPENGLES2;
 break;
  case __DRI_API_OPENGL_CORE:
 +mesa_api = API_OPENGL_CORE;
 +break;
  default:
 *error = __DRI_CTX_ERROR_BAD_API;
 return NULL;
 @@ -218,6 +220,19 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
 }
  }

 +/* Mesa does not support the GL_ARB_compatibilty extension or the
 + * compatibility profile.  This means that we treat a API_OPENGL 3.1 as
 + * API_OPENGL_CORE and reject API_OPENGL 3.2+.
 + */
 +if (mesa_api == API_OPENGL  major_version == 3  minor_version == 1)
 +   mesa_api = API_OPENGL_CORE;
 +
 +if (mesa_api == API_OPENGL
 + ((major_version  3)
 +|| (major_version == 3  minor_version = 2))) {
 +   mesa_api = API_OPENGL_CORE;
 +}
 +
  /* The EGL_KHR_create_context spec says:
   *
   * Flags are only defined for OpenGL context creation, and 
 specifying
 diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
 b/src/mesa/drivers/dri/intel/intel_screen.c
 index 3c595bc..e541c7f 100644
 --- a/src/mesa/drivers/dri/intel/intel_screen.c
 +++ b/src/mesa/drivers/dri/intel/intel_screen.c
 @@ -701,6 +701,23 @@ intelCreateContext(gl_api api,
 struct intel_screen *intelScreen = sPriv-driverPrivate;
 bool success = false;

 +   switch (api) {
 +   case API_OPENGL:
 +   case API_OPENGLES:
 +  break;
 +   case API_OPENGLES2:
 +#ifdef I915
 +  if (!IS_9XX(intelScreen-deviceID)) {
 + *error = __DRI_CTX_ERROR_BAD_API;
 + return false;
 +  }
 +#endif
 +  break;
 +   case API_OPENGL_CORE:
 +  *error = __DRI_CTX_ERROR_BAD_API;
 +  return GL_FALSE;
 +   }
 +
  #ifdef I915
 if (IS_9XX(intelScreen-deviceID)) {
if (!IS_965(intelScreen-deviceID)) {
 diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
 b/src/mesa/drivers/dri/nouveau/nouveau_context.c
 index f794308..4409eae 100644
 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
 +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
 @@ -59,9 +59,31 @@ nouveau_context_create(gl_api api,
 struct nouveau_context *nctx;
 struct gl_context *ctx;

 +   switch (api) {
 +   case API_OPENGL:
 +   /* Do after-the-fact version checking (below).
 +*/
 +   break;
 +   case API_OPENGLES:
 +   /* NV10 and NV20 can support OpenGL ES 1.0 only.  Older chips
 +* cannot do even that.
 +*/
 +   if ((screen-device-chipset  0xf0) == 0x00) {
 +   *error = __DRI_CTX_ERROR_BAD_API;
 +   return GL_FALSE;
 +   } else if (minor_version != 0) {
 +   *error = __DRI_CTX_ERROR_BAD_VERSION;
 +   return GL_FALSE;
 +   }
 +   break;
 +   case API_OPENGLES2:
 +   case API_OPENGL_CORE:
 +   *error = __DRI_CTX_ERROR_BAD_API;
 +   return GL_FALSE;
 +   }
 +
 /* API and flag filtering is handled in dri2CreateContextAttribs.
  */
 -   (void) api;
 (void) flags;

 ctx = screen-driver-context_create(screen, visual, share_ctx);
 diff --git a/src/mesa/drivers/dri/r200/r200_context.c 
 b/src/mesa/drivers/dri/r200/r200_context.c
 index 17e08a1..5f8cc86 100644
 --- a/src/mesa/drivers/dri/r200/r200_context.c
 +++ b/src/mesa/drivers/dri/r200/r200_context.c
 @@ -212,9 +212,22 @@ GLboolean r200CreateContext( gl_api api,
 int i;
 int tcl_mode;

 -   /* API and flag filtering is handled in dri2CreateContextAttribs.
 +   switch (api) {
 +   case API_OPENGL:
 +  if (major_version  1 || minor_version  3) {

This checks for GL  1.3. Is that what is needed here?

I was thinking that for API_OPENGL 

Re: [Mesa-dev] [PATCH v2] i965: Rework the extra flushes surrounding occlusion queries.

2012-08-08 Thread Daniel Vetter
On Wed, Aug 08, 2012 at 10:18:43AM -0700, Kenneth Graunke wrote:
 This removes the CS stall on Ivybridge.
 
 On Sandybridge, the depth stall needs to be preceded by a non-zero
 post-sync op, which requires a CS stall, which needs a stall at
 scoreboard.  Emit the full workaround.
 
 Cc: Daniel Vetter daniel.vet...@ffwll.ch
 Cc: Eric Anholt e...@anholt.net
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org

v2 lsooks good to me now.

Reviewed-by: Daniel Vetter daniel.vet...@ffwll.ch
-- 
Daniel Vetter
Mail: dan...@ffwll.ch
Mobile: +41 (0)79 365 57 48
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 07/14] dri: Pass API_OPENGL_CORE through to the drivers

2012-08-08 Thread Ian Romanick
These drivers can only do OpenGL 1.3.

(Sent from my phone.)

On Aug 8, 2012, at 11:21 AM, Jordan Justen jljus...@gmail.com wrote:

 On Wed, Aug 8, 2012 at 10:38 AM, Ian Romanick i...@freedesktop.org wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 This forces the drivers to do at least some validation of context API
 and version before creating the context.  In r100 and r200 drivers, this
 means that they don't do any post-hoc validation.
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
 src/mesa/drivers/dri/common/dri_util.c |   15 +++
 src/mesa/drivers/dri/intel/intel_screen.c  |   17 +
 src/mesa/drivers/dri/nouveau/nouveau_context.c |   24 
 +++-
 src/mesa/drivers/dri/r200/r200_context.c   |   22 +++---
 src/mesa/drivers/dri/radeon/radeon_context.c   |   22 +++---
 src/mesa/drivers/dri/swrast/swrast.c   |   19 ++-
 6 files changed, 99 insertions(+), 20 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/common/dri_util.c 
 b/src/mesa/drivers/dri/common/dri_util.c
 index 91ae186..025a14a 100644
 --- a/src/mesa/drivers/dri/common/dri_util.c
 +++ b/src/mesa/drivers/dri/common/dri_util.c
 @@ -192,6 +192,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
mesa_api = API_OPENGLES2;
break;
 case __DRI_API_OPENGL_CORE:
 +mesa_api = API_OPENGL_CORE;
 +break;
 default:
*error = __DRI_CTX_ERROR_BAD_API;
return NULL;
 @@ -218,6 +220,19 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
}
 }
 
 +/* Mesa does not support the GL_ARB_compatibilty extension or the
 + * compatibility profile.  This means that we treat a API_OPENGL 3.1 as
 + * API_OPENGL_CORE and reject API_OPENGL 3.2+.
 + */
 +if (mesa_api == API_OPENGL  major_version == 3  minor_version == 1)
 +   mesa_api = API_OPENGL_CORE;
 +
 +if (mesa_api == API_OPENGL
 + ((major_version  3)
 +|| (major_version == 3  minor_version = 2))) {
 +   mesa_api = API_OPENGL_CORE;
 +}
 +
 /* The EGL_KHR_create_context spec says:
  *
  * Flags are only defined for OpenGL context creation, and 
 specifying
 diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
 b/src/mesa/drivers/dri/intel/intel_screen.c
 index 3c595bc..e541c7f 100644
 --- a/src/mesa/drivers/dri/intel/intel_screen.c
 +++ b/src/mesa/drivers/dri/intel/intel_screen.c
 @@ -701,6 +701,23 @@ intelCreateContext(gl_api api,
struct intel_screen *intelScreen = sPriv-driverPrivate;
bool success = false;
 
 +   switch (api) {
 +   case API_OPENGL:
 +   case API_OPENGLES:
 +  break;
 +   case API_OPENGLES2:
 +#ifdef I915
 +  if (!IS_9XX(intelScreen-deviceID)) {
 + *error = __DRI_CTX_ERROR_BAD_API;
 + return false;
 +  }
 +#endif
 +  break;
 +   case API_OPENGL_CORE:
 +  *error = __DRI_CTX_ERROR_BAD_API;
 +  return GL_FALSE;
 +   }
 +
 #ifdef I915
if (IS_9XX(intelScreen-deviceID)) {
   if (!IS_965(intelScreen-deviceID)) {
 diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
 b/src/mesa/drivers/dri/nouveau/nouveau_context.c
 index f794308..4409eae 100644
 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
 +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
 @@ -59,9 +59,31 @@ nouveau_context_create(gl_api api,
struct nouveau_context *nctx;
struct gl_context *ctx;
 
 +   switch (api) {
 +   case API_OPENGL:
 +   /* Do after-the-fact version checking (below).
 +*/
 +   break;
 +   case API_OPENGLES:
 +   /* NV10 and NV20 can support OpenGL ES 1.0 only.  Older chips
 +* cannot do even that.
 +*/
 +   if ((screen-device-chipset  0xf0) == 0x00) {
 +   *error = __DRI_CTX_ERROR_BAD_API;
 +   return GL_FALSE;
 +   } else if (minor_version != 0) {
 +   *error = __DRI_CTX_ERROR_BAD_VERSION;
 +   return GL_FALSE;
 +   }
 +   break;
 +   case API_OPENGLES2:
 +   case API_OPENGL_CORE:
 +   *error = __DRI_CTX_ERROR_BAD_API;
 +   return GL_FALSE;
 +   }
 +
/* API and flag filtering is handled in dri2CreateContextAttribs.
 */
 -   (void) api;
(void) flags;
 
ctx = screen-driver-context_create(screen, visual, share_ctx);
 diff --git a/src/mesa/drivers/dri/r200/r200_context.c 
 b/src/mesa/drivers/dri/r200/r200_context.c
 index 17e08a1..5f8cc86 100644
 --- a/src/mesa/drivers/dri/r200/r200_context.c
 +++ b/src/mesa/drivers/dri/r200/r200_context.c
 @@ -212,9 +212,22 @@ GLboolean r200CreateContext( gl_api api,
int i;
int tcl_mode;
 
 -   /* API and flag filtering is handled in dri2CreateContextAttribs.
 +   switch (api) {
 +   case API_OPENGL:
 +  if (major_version  1 || 

Re: [Mesa-dev] [PATCH 06/14] mesa: Filter a bunch more functions based on API

2012-08-08 Thread Kenneth Graunke
On 08/08/2012 10:38 AM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com

Two small mistakes, noted below.

 diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
 index 81be46d..67f17a4 100644
 --- a/src/mesa/main/api_exec.c
 +++ b/src/mesa/main/api_exec.c
 @@ -158,7 +158,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
 SET_GetError(exec, _mesa_GetError);
 SET_GetFloatv(exec, _mesa_GetFloatv);
 SET_GetString(exec, _mesa_GetString);
 -   if (ctx-API != API_OPENGL_CORE) {
 +   if (ctx-API == API_OPENGL) {
SET_LineStipple(exec, _mesa_LineStipple);
 }
 SET_LineWidth(exec, _mesa_LineWidth);
 @@ -197,13 +197,13 @@ _mesa_create_exec_table(struct gl_context *ctx)
 }
 SET_Viewport(exec, _mesa_Viewport);
  
 -   if (ctx-API != API_OPENGL_CORE) {
 +   if (ctx-API == API_OPENGL) {
_mesa_init_accum_dispatch(exec);
_mesa_init_dlist_dispatch(exec);
 }
  
 SET_ClearDepth(exec, _mesa_ClearDepth);
 -   if (ctx-API != API_OPENGL_CORE) {
 +   if (ctx-API == API_OPENGL) {
SET_ClearIndex(exec, _mesa_ClearIndex);
SET_ClipPlane(exec, _mesa_ClipPlane);

glClipPlane is allowed in ES 1.1.  The rest in this block are not.

SET_ColorMaterial(exec, _mesa_ColorMaterial);
 @@ -213,9 +213,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
 SET_DepthRange(exec, _mesa_DepthRange);
  
 _mesa_init_drawpix_dispatch(exec);
 -   _mesa_init_feedback_dispatch(exec);
 +   if (ctx-API == API_OPENGL) {
 +  _mesa_init_feedback_dispatch(exec);
 +   }
  
 -   if (ctx-API != API_OPENGL_CORE) {
 +   if (ctx-API == API_OPENGL) {
SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
SET_Fogf(exec, _mesa_Fogf);
SET_Fogfv(exec, _mesa_Fogfv);
 @@ -241,7 +243,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
 SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
 SET_GetTexImage(exec, _mesa_GetTexImage);
 SET_Hint(exec, _mesa_Hint);
 -   if (ctx-API != API_OPENGL_CORE) {
 +   if (ctx-API == API_OPENGL) {
SET_IndexMask(exec, _mesa_IndexMask);
 }

Oddly, the ES 2.0.24 spec mentions just as for IndexMask and includes
IndexMask in the spec's index (no pun intended).  This seems to be an
error, however, since it never actually defines what the function does.

So I think this hunk is correct.

 SET_IsEnabled(exec, _mesa_IsEnabled);
 @@ -257,24 +259,22 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
 }
  
 -   _mesa_init_eval_dispatch(exec);
 -
 -   if (ctx-API != API_OPENGL_CORE) {
 +   if (ctx-API == API_OPENGL) {
 +  _mesa_init_eval_dispatch(exec);
SET_MultMatrixd(exec, _mesa_MultMatrixd);
 +  _mesa_init_pixel_dispatch(exec);
 }
  
 -   _mesa_init_pixel_dispatch(exec);
 -
 SET_PixelStoref(exec, _mesa_PixelStoref);
 SET_PointSize(exec, _mesa_PointSize);
 SET_PolygonMode(exec, _mesa_PolygonMode);
 SET_PolygonOffset(exec, _mesa_PolygonOffset);
 -   if (ctx-API != API_OPENGL_CORE) {
 +   if (ctx-API == API_OPENGL) {
SET_PolygonStipple(exec, _mesa_PolygonStipple);
 -   }
  
 -   _mesa_init_attrib_dispatch(exec);
 -   _mesa_init_rastpos_dispatch(exec);
 +  _mesa_init_attrib_dispatch(exec);
 +  _mesa_init_rastpos_dispatch(exec);
 +   }
  
 SET_ReadPixels(exec, _mesa_ReadPixels);
 if (ctx-API != API_OPENGL_CORE) {
 @@ -285,13 +285,15 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_TexEnviv(exec, _mesa_TexEnviv);
 }
  
 -   _mesa_init_texgen_dispatch(exec);
 +   if (ctx-API != API_OPENGL_CORE) {
 +  _mesa_init_texgen_dispatch(exec);
 +   }
 SET_TexImage1D(exec, _mesa_TexImage1D);
 SET_TexParameterf(exec, _mesa_TexParameterf);
 SET_TexParameterfv(exec, _mesa_TexParameterfv);
 SET_TexParameteriv(exec, _mesa_TexParameteriv);
 -   if (ctx-API != API_OPENGL_CORE) {
 +   if (ctx-API == API_OPENGL) {
SET_Translated(exec, _mesa_Translated);
 }
  
 @@ -300,7 +302,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
 SET_DeleteTextures(exec, _mesa_DeleteTextures);
 SET_GenTextures(exec, _mesa_GenTextures);
  #if _HAVE_FULL_GL
 -   if (ctx-API != API_OPENGL_CORE) {
 +   if (ctx-API == API_OPENGL) {
SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
SET_ColorPointer(exec, _mesa_ColorPointer);

glColorPointer is allowed in ES 1.1.

Otherwise, looks good!  With those fixed,
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 07/14] dri: Pass API_OPENGL_CORE through to the drivers

2012-08-08 Thread Kenneth Graunke
On 08/08/2012 10:38 AM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 This forces the drivers to do at least some validation of context API
 and version before creating the context.  In r100 and r200 drivers, this
 means that they don't do any post-hoc validation.
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  src/mesa/drivers/dri/common/dri_util.c |   15 +++
  src/mesa/drivers/dri/intel/intel_screen.c  |   17 +
  src/mesa/drivers/dri/nouveau/nouveau_context.c |   24 
 +++-
  src/mesa/drivers/dri/r200/r200_context.c   |   22 +++---
  src/mesa/drivers/dri/radeon/radeon_context.c   |   22 +++---
  src/mesa/drivers/dri/swrast/swrast.c   |   19 ++-
  6 files changed, 99 insertions(+), 20 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/common/dri_util.c 
 b/src/mesa/drivers/dri/common/dri_util.c
 index 91ae186..025a14a 100644
 --- a/src/mesa/drivers/dri/common/dri_util.c
 +++ b/src/mesa/drivers/dri/common/dri_util.c
 @@ -192,6 +192,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
   mesa_api = API_OPENGLES2;
   break;
  case __DRI_API_OPENGL_CORE:
 +mesa_api = API_OPENGL_CORE;
 +break;
  default:
   *error = __DRI_CTX_ERROR_BAD_API;
   return NULL;
 @@ -218,6 +220,19 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
   }
  }
  
 +/* Mesa does not support the GL_ARB_compatibilty extension or the
 + * compatibility profile.  This means that we treat a API_OPENGL 3.1 as
 + * API_OPENGL_CORE and reject API_OPENGL 3.2+.
 + */
 +if (mesa_api == API_OPENGL  major_version == 3  minor_version == 1)
 +   mesa_api = API_OPENGL_CORE;
 +
 +if (mesa_api == API_OPENGL
 + ((major_version  3)
 +|| (major_version == 3  minor_version = 2))) {
 +   mesa_api = API_OPENGL_CORE;
 +}

This doesn't look like rejecting API_OPENGL 3.2+.  It looks like it
converts it to API_OPENGL_CORE, just like you did for 3.1.

I'll take your word for it that r100/r200 can only support GL 1.3, and
about the NV chips.

Looks OK other than that.

 +
  /* The EGL_KHR_create_context spec says:
   *
   * Flags are only defined for OpenGL context creation, and 
 specifying
 diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
 b/src/mesa/drivers/dri/intel/intel_screen.c
 index 3c595bc..e541c7f 100644
 --- a/src/mesa/drivers/dri/intel/intel_screen.c
 +++ b/src/mesa/drivers/dri/intel/intel_screen.c
 @@ -701,6 +701,23 @@ intelCreateContext(gl_api api,
 struct intel_screen *intelScreen = sPriv-driverPrivate;
 bool success = false;
  
 +   switch (api) {
 +   case API_OPENGL:
 +   case API_OPENGLES:
 +  break;
 +   case API_OPENGLES2:
 +#ifdef I915
 +  if (!IS_9XX(intelScreen-deviceID)) {
 + *error = __DRI_CTX_ERROR_BAD_API;
 + return false;
 +  }
 +#endif
 +  break;
 +   case API_OPENGL_CORE:
 +  *error = __DRI_CTX_ERROR_BAD_API;
 +  return GL_FALSE;
 +   }
 +
  #ifdef I915
 if (IS_9XX(intelScreen-deviceID)) {
if (!IS_965(intelScreen-deviceID)) {
 diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
 b/src/mesa/drivers/dri/nouveau/nouveau_context.c
 index f794308..4409eae 100644
 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
 +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
 @@ -59,9 +59,31 @@ nouveau_context_create(gl_api api,
   struct nouveau_context *nctx;
   struct gl_context *ctx;
  
 + switch (api) {
 + case API_OPENGL:
 + /* Do after-the-fact version checking (below).
 +  */
 + break;
 + case API_OPENGLES:
 + /* NV10 and NV20 can support OpenGL ES 1.0 only.  Older chips
 +  * cannot do even that.
 +  */
 + if ((screen-device-chipset  0xf0) == 0x00) {
 + *error = __DRI_CTX_ERROR_BAD_API;
 + return GL_FALSE;
 + } else if (minor_version != 0) {
 + *error = __DRI_CTX_ERROR_BAD_VERSION;
 + return GL_FALSE;
 + }
 + break;
 + case API_OPENGLES2:
 + case API_OPENGL_CORE:
 + *error = __DRI_CTX_ERROR_BAD_API;
 + return GL_FALSE;
 + }
 +
   /* API and flag filtering is handled in dri2CreateContextAttribs.
*/
 - (void) api;
   (void) flags;
  
   ctx = screen-driver-context_create(screen, visual, share_ctx);
 diff --git a/src/mesa/drivers/dri/r200/r200_context.c 
 b/src/mesa/drivers/dri/r200/r200_context.c
 index 17e08a1..5f8cc86 100644
 --- a/src/mesa/drivers/dri/r200/r200_context.c
 +++ b/src/mesa/drivers/dri/r200/r200_context.c
 @@ -212,9 +212,22 @@ GLboolean r200CreateContext( gl_api api,
 int i;
 int tcl_mode;
  
 -   /* API and flag filtering is handled in dri2CreateContextAttribs.
 +   switch (api) {
 

[Mesa-dev] [PATCH] i915: Re-enable Z16/Z24 formats.

2012-08-08 Thread Reimar Döffinger
This allows MPlayer to (mis-)use depth textures to quickly upload
and render 16-bit per component YUV video.
There is still the issue that the actual precision is only around
10-bits, at least when using it in the way MPlayer does.
If someone knows an explanation for that I'd like to hear it, however
it is not related to this change as the precision is the same
with Z16 disable which ends up converting to X8Z24 first.

Signed-off-by: Reimar Döffinger reimar.doeffin...@gmx.de
---
 src/mesa/drivers/dri/i915/i915_context.c |9 -
 1 file changed, 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i915_context.c 
b/src/mesa/drivers/dri/i915/i915_context.c
index dc32292..4de49f5 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -113,17 +113,8 @@ intel_init_texture_formats(struct gl_context *ctx)
ctx-TextureFormatSupported[MESA_FORMAT_S8_Z24] = true;
ctx-TextureFormatSupported[MESA_FORMAT_X8_Z24] = true;
ctx-TextureFormatSupported[MESA_FORMAT_S8] = intel-has_separate_stencil;
-
-   /*
-* This was disabled in initial FBO enabling to avoid combinations
-* of depth+stencil that wouldn't work together.  We since decided
-* that it was OK, since it's up to the app to come up with the
-* combo that actually works, so this can probably be re-enabled.
-*/
-   /*
ctx-TextureFormatSupported[MESA_FORMAT_Z16] = true;
ctx-TextureFormatSupported[MESA_FORMAT_Z24] = true;
-   */
 
/* ctx-Extensions.MESA_ycbcr_texture */
ctx-TextureFormatSupported[MESA_FORMAT_YCBCR] = true;
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH 08/14] intel: In the i915 driver, the chipset cannot be i965

2012-08-08 Thread Kenneth Graunke
On 08/08/2012 10:38 AM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 In the i965 dirver, the chipset must be i965.
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  src/mesa/drivers/dri/intel/intel_screen.c |   13 +
  1 files changed, 5 insertions(+), 8 deletions(-)

What you're asserting here is that the loader will only ever try to load
i915_dri.so on a pre-965 PCI ID, and only try to load i965_dri.so on a
965+ PCI ID.

If that's the case, then yes, kill this code.  Otherwise, it's
absolutely necessary.  I haven't trekked through the loader code to know
one way or another.

 diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
 b/src/mesa/drivers/dri/intel/intel_screen.c
 index e541c7f..54ad112 100644
 --- a/src/mesa/drivers/dri/intel/intel_screen.c
 +++ b/src/mesa/drivers/dri/intel/intel_screen.c
 @@ -720,20 +720,17 @@ intelCreateContext(gl_api api,
  
  #ifdef I915
 if (IS_9XX(intelScreen-deviceID)) {
 -  if (!IS_965(intelScreen-deviceID)) {
 -  success = i915CreateContext(api, mesaVis, driContextPriv,
 -  sharedContextPrivate);
 -  }
 +  success = i915CreateContext(api, mesaVis, driContextPriv,
 +  sharedContextPrivate);
 } else {
intelScreen-no_vbo = true;
success = i830CreateContext(mesaVis, driContextPriv,
 sharedContextPrivate);
 }
  #else
 -   if (IS_965(intelScreen-deviceID))
 -  success = brwCreateContext(api, mesaVis,
 -   driContextPriv,
 -   sharedContextPrivate);
 +   success = brwCreateContext(api, mesaVis,
 + driContextPriv,
 + sharedContextPrivate);
  #endif
  
 if (success) {
 

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


[Mesa-dev] [PATCH 1/3] i965: Add a safety check for brw_set_saturate().

2012-08-08 Thread Eric Anholt
There is an easy chance for bugs in brw_wm_emit.c, where you would pass 1  5
instead of 1, which would get truncated to 0.
---
 src/mesa/drivers/dri/i965/brw_eu.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/brw_eu.c 
b/src/mesa/drivers/dri/i965/brw_eu.c
index 2c432a9..7697d08 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -143,6 +143,7 @@ void brw_set_mask_control( struct brw_compile *p, GLuint 
value )
 
 void brw_set_saturate( struct brw_compile *p, GLuint value )
 {
+   assert(value == 0 || value == 1);
p-current-header.saturate = value;
 }
 
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH 10/14] i915: Validate API and version in i915CreateContext

2012-08-08 Thread Kenneth Graunke
On 08/08/2012 10:38 AM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  src/mesa/drivers/dri/i915/i915_context.c  |   35 
 -
  src/mesa/drivers/dri/i915/i915_context.h  |3 ++
  src/mesa/drivers/dri/intel/intel_screen.c |4 +++
  3 files changed, 41 insertions(+), 1 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i915/i915_context.c 
 b/src/mesa/drivers/dri/i915/i915_context.c
 index dc32292..0729479 100644
 --- a/src/mesa/drivers/dri/i915/i915_context.c
 +++ b/src/mesa/drivers/dri/i915/i915_context.c
 @@ -146,6 +146,9 @@ bool
  i915CreateContext(int api,
 const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
 +  unsigned major_version,
 +  unsigned minor_version,
 +  unsigned *error,
void *sharedContextPrivate)
  {
 struct dd_function_table functions;
 @@ -153,8 +156,10 @@ i915CreateContext(int api,
 struct intel_context *intel = i915-intel;
 struct gl_context *ctx = intel-ctx;
  
 -   if (!i915)
 +   if (!i915) {
 +  *error = __DRI_CTX_ERROR_NO_MEMORY;
return false;
 +   }
  
 i915InitVtbl(i915);
  
 @@ -163,6 +168,34 @@ i915CreateContext(int api,
 if (!intelInitContext(intel, api, mesaVis, driContextPriv,
   sharedContextPrivate, functions)) {
FREE(i915);
 +  *error = __DRI_CTX_ERROR_NO_MEMORY;
 +  return false;
 +   }
 +
 +   /* Now that the extension bits are known, filter against the requested API
 +* and version.
 +*/
 +   switch (api) {
 +   case API_OPENGL: {
 +  const unsigned max_version =
 + (ctx-Extensions.ARB_fragment_shader
 +   ctx-Extensions.ARB_occlusion_query)
 + ? 0x200 : 0x105;
 +  const unsigned req_version = (major_version  8) | minor_version;

Not the most readable of code.  I'd prefer:

   const unsigned max_version =
  (ctx-Extensions.ARB_fragment_shader 
   ctx-Extensions.ARB_occlusion_query) ? 20 : 15;

   const unsigned requested_ver = major_version * 10 + minor_version;

That matches the style we use in ctx-Version.  Otherwise,
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

 +  if (req_version  max_version) {
 + *error = __DRI_CTX_ERROR_BAD_VERSION;
 + FREE(i915);
 + return false;
 +  }
 +  break;
 +   }
 +   case API_OPENGLES:
 +   case API_OPENGLES2:
 +  break;
 +   default:
 +  *error = __DRI_CTX_ERROR_BAD_API;
 +  FREE(i915);
return false;
 }
  
 diff --git a/src/mesa/drivers/dri/i915/i915_context.h 
 b/src/mesa/drivers/dri/i915/i915_context.h
 index 7037465..f5c1596 100644
 --- a/src/mesa/drivers/dri/i915/i915_context.h
 +++ b/src/mesa/drivers/dri/i915/i915_context.h
 @@ -322,6 +322,9 @@ do {  
 \
  extern bool i915CreateContext(int api,
 const struct gl_config * mesaVis,
 __DRIcontext * driContextPriv,
 +  unsigned major_version,
 +  unsigned minor_version,
 +  unsigned *error,
 void *sharedContextPrivate);
  
  
 diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
 b/src/mesa/drivers/dri/intel/intel_screen.c
 index 2fef8fe..bc8c265 100644
 --- a/src/mesa/drivers/dri/intel/intel_screen.c
 +++ b/src/mesa/drivers/dri/intel/intel_screen.c
 @@ -680,6 +680,9 @@ extern bool
  i915CreateContext(int api,
 const struct gl_config *mesaVis,
 __DRIcontext *driContextPriv,
 +  unsigned major_version,
 +  unsigned minor_version,
 +  unsigned *error,
 void *sharedContextPrivate);
  extern bool
  brwCreateContext(int api,
 @@ -721,6 +724,7 @@ intelCreateContext(gl_api api,
  #ifdef I915
 if (IS_9XX(intelScreen-deviceID)) {
success = i915CreateContext(api, mesaVis, driContextPriv,
 +  major_version, minor_version, error,
sharedContextPrivate);
 } else {
switch (api) {
 

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


Re: [Mesa-dev] [PATCH 13/14] i965: Advertise GLSL 1.40 and TexBOs in core contexts

2012-08-08 Thread Kenneth Graunke
On 08/08/2012 10:38 AM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  src/mesa/drivers/dri/intel/intel_extensions.c |   10 +-
  1 files changed, 9 insertions(+), 1 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
 b/src/mesa/drivers/dri/intel/intel_extensions.c
 index 76b56a2..10e664b 100755
 --- a/src/mesa/drivers/dri/intel/intel_extensions.c
 +++ b/src/mesa/drivers/dri/intel/intel_extensions.c
 @@ -93,7 +93,11 @@ intelInitExtensions(struct gl_context *ctx)
 ctx-Extensions.OES_compressed_ETC1_RGB8_texture = true;
  
 if (intel-gen = 6)
 -  ctx-Const.GLSLVersion = 130;
 +  if (ctx-API == API_OPENGL_CORE) {
 + ctx-Const.GLSLVersion = 140;
 +  } else {
 + ctx-Const.GLSLVersion = 130;
 +  }
 else
ctx-Const.GLSLVersion = 120;
 _mesa_override_glsl_version(ctx);
 @@ -106,6 +110,10 @@ intelInitExtensions(struct gl_context *ctx)
ctx-Extensions.ARB_blend_func_extended = 
 !driQueryOptionb(intel-optionCache, disable_blend_func_extended);
ctx-Extensions.ARB_draw_buffers_blend = true;
ctx-Extensions.ARB_uniform_buffer_object = true;
 +
 +  if (ctx-API == API_OPENGL_CORE) {
 + ctx-Extensions.ARB_texture_buffer_object = true;
 +  }

As it stands, this would begin advertising the ARB_texture_buffer_object
extension on 3.1.  I don't think we want to do that, since the extension
specs luminance/alpha bits, and we don't support those.

If you changed ARB_texture_buffer_object to GLL in extensions.c, I would
be fine with this change.

 }
  
 if (intel-gen = 5)
 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/3] i965/vs: Protect pow(x, y) MOV of y on gen4 from other instruction flags.

2012-08-08 Thread Eric Anholt
I don't know if it was possible to trigger this bug -- we don't merge
saturates into the math instruction because we're bad at coalescing currently,
and there's nothing generating these with predicates.  Still, let's avoid
future bugs when we do smarter codegen.
---
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp |4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index 21eafcb..e63e08d 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -348,7 +348,11 @@ vec4_visitor::generate_math2_gen4(vec4_instruction *inst,
struct brw_reg op0 = is_int_div ? src1 : src0;
struct brw_reg op1 = is_int_div ? src0 : src1;
 
+   brw_push_insn_state(p);
+   brw_set_saturate(p, false);
+   brw_set_predicate_control(p, BRW_PREDICATE_NONE);
brw_MOV(p, retype(brw_message_reg(inst-base_mrf + 1), op1.type), op1);
+   brw_pop_insn_state(p);
 
brw_math(p,
dst,
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 2/3] i965: Drop the confusing saturate argument to math instruction setup.

2012-08-08 Thread Eric Anholt
This was ridiculous.  We were ignoring the inst-header.saturate flag in the
case of math and only math.  On gen4, we would leave inst-header.saturate in
place if it happened to be set, which would end up being applied to the
implicit mov and thus trash the first argument.  On gen6, we would overwrite
inst-header.saturate with the saturate flag from the argument, which was not
set appropriately in brw_vec4_emit.cpp, and was only not a bug due to our
incompetence at coalescing saturate moves.

By ripping the argument out and making saturate work just like all the other
brw_eu_emit.c code generation, we can avoid both these classes of bugs.

Fixes piglit fog-modes, and the new specific fs-saturate-exp2 case.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48628
NOTE: This is a candidate for the 8.0 branch.
---
 src/mesa/drivers/dri/i965/brw_eu.h  |2 --
 src/mesa/drivers/dri/i965/brw_eu_emit.c |   14 --
 src/mesa/drivers/dri/i965/brw_eu_util.c |1 -
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp   |   10 --
 src/mesa/drivers/dri/i965/brw_sf_emit.c |2 --
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp |3 ---
 src/mesa/drivers/dri/i965/brw_vs_emit.c |3 ---
 src/mesa/drivers/dri/i965/brw_wm_emit.c |   15 ++-
 8 files changed, 6 insertions(+), 44 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
b/src/mesa/drivers/dri/i965/brw_eu.h
index 233b94c..6cab32d 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -975,7 +975,6 @@ void brw_SAMPLE(struct brw_compile *p,
 void brw_math_16( struct brw_compile *p,
  struct brw_reg dest,
  GLuint function,
- GLuint saturate,
  GLuint msg_reg_nr,
  struct brw_reg src,
  GLuint precision );
@@ -983,7 +982,6 @@ void brw_math_16( struct brw_compile *p,
 void brw_math( struct brw_compile *p,
   struct brw_reg dest,
   GLuint function,
-  GLuint saturate,
   GLuint msg_reg_nr,
   struct brw_reg src,
   GLuint data_type,
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 25bf91b..b82a858 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -429,7 +429,6 @@ static void brw_set_math_message( struct brw_compile *p,
  GLuint function,
  GLuint integer_type,
  bool low_precision,
- bool saturate,
  GLuint dataType )
 {
struct brw_context *brw = p-brw;
@@ -461,22 +460,24 @@ static void brw_set_math_message( struct brw_compile *p,
   break;
}
 
+
brw_set_message_descriptor(p, insn, BRW_SFID_MATH,
  msg_length, response_length, false, false);
if (intel-gen == 5) {
   insn-bits3.math_gen5.function = function;
   insn-bits3.math_gen5.int_type = integer_type;
   insn-bits3.math_gen5.precision = low_precision;
-  insn-bits3.math_gen5.saturate = saturate;
+  insn-bits3.math_gen5.saturate = insn-header.saturate;
   insn-bits3.math_gen5.data_type = dataType;
   insn-bits3.math_gen5.snapshot = 0;
} else {
   insn-bits3.math.function = function;
   insn-bits3.math.int_type = integer_type;
   insn-bits3.math.precision = low_precision;
-  insn-bits3.math.saturate = saturate;
+  insn-bits3.math.saturate = insn-header.saturate;
   insn-bits3.math.data_type = dataType;
}
+   insn-header.saturate = 0;
 }
 
 
@@ -1657,7 +1658,6 @@ void brw_WAIT (struct brw_compile *p)
 void brw_math( struct brw_compile *p,
   struct brw_reg dest,
   GLuint function,
-  GLuint saturate,
   GLuint msg_reg_nr,
   struct brw_reg src,
   GLuint data_type,
@@ -1693,7 +1693,6 @@ void brw_math( struct brw_compile *p,
* becomes FC[3:0] and ThreadCtrl becomes FC[5:4].
*/
   insn-header.destreg__conditionalmod = function;
-  insn-header.saturate = saturate;
 
   brw_set_dest(p, insn, dest);
   brw_set_src0(p, insn, src);
@@ -1714,7 +1713,6 @@ void brw_math( struct brw_compile *p,
   function,
   src.type == BRW_REGISTER_TYPE_D,
   precision,
-  saturate,
   data_type);
}
 }
@@ -1779,7 +1777,6 @@ void brw_math2(struct brw_compile *p,
 void brw_math_16( struct brw_compile *p,
  struct brw_reg dest,
  GLuint function,
- GLuint saturate,
  GLuint msg_reg_nr,
  struct brw_reg src,
  GLuint precision )
@@ -1794,7 +1791,6 @@ void brw_math_16( struct brw_compile *p,
   

Re: [Mesa-dev] [PATCH 14/14] i965: Allow creation of OpenGL 3.1 contexts

2012-08-08 Thread Kenneth Graunke
On 08/08/2012 10:38 AM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  src/mesa/drivers/dri/i965/brw_context.c |   19 +++
  1 files changed, 19 insertions(+), 0 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
 b/src/mesa/drivers/dri/i965/brw_context.c
 index 013ec14..990b467 100644
 --- a/src/mesa/drivers/dri/i965/brw_context.c
 +++ b/src/mesa/drivers/dri/i965/brw_context.c
 @@ -108,6 +108,25 @@ brwCreateContext(int api,
 case API_OPENGLES:
 case API_OPENGLES2:
break;
 +   case API_OPENGL_CORE: {

I feel like this could be made more readable as:

#ifndef TEXTURE_FLOAT_ENABLED
*error = __DRI_CTX_ERROR_BAD_API;
return false;
#else
if (screen-gen  6 || screen-gen == 7 
screen-kernel_has_gen7_sol_reset) {
   *error = __DRI_CTX_ERROR_BAD_API;
   return false;
}

if (major_version * 10 + minor_version  31) {
   *error = __DRI_CTX_ERROR_BAD_VERSION;
   return false;
}
#endif

 +#ifdef TEXTURE_FLOAT_ENABLED
 +  const unsigned max_version =
 + (screen-gen == 6 ||
 +  (screen-gen == 7  screen-kernel_has_gen7_sol_reset))
 + ? 0x301 : 0;
 +#else
 +  const unsigned max_version = 0;
 +#endif
 +  const unsigned req_version = (major_version  8) | minor_version;
 +
 +  if (req_version  max_version) {
 + *error = (max_version == 0)
 +? __DRI_CTX_ERROR_BAD_API : __DRI_CTX_ERROR_BAD_VERSION;
 + return false;
 +  }
 +
 +  break;
 +   }
 default:
*error = __DRI_CTX_ERROR_BAD_API;
return false;

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


Re: [Mesa-dev] [PATCH 01/14] mesa: Don't advertise deprecated extensions in a core context

2012-08-08 Thread Kenneth Graunke
On 08/08/2012 10:38 AM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 It may be possible to trim the list of extensions futher.  These are
 just the obvious extensions that add functionality that the core context
 explicitly forbids.  Apple's core-context extension list is *just* the
 extensions on top of the core GL version.  I'm not sure we want to go
 that far, but removing some things that have been in core since 2.1 may
 be okay.
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com

Patches 1-5 look fine.
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

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


Re: [Mesa-dev] [PATCH 1/3] i965: Add a safety check for brw_set_saturate().

2012-08-08 Thread Kenneth Graunke
On 08/08/2012 03:08 PM, Eric Anholt wrote:
 There is an easy chance for bugs in brw_wm_emit.c, where you would pass 1  5
 instead of 1, which would get truncated to 0.
 ---
  src/mesa/drivers/dri/i965/brw_eu.c |1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_eu.c 
 b/src/mesa/drivers/dri/i965/brw_eu.c
 index 2c432a9..7697d08 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu.c
 +++ b/src/mesa/drivers/dri/i965/brw_eu.c
 @@ -143,6 +143,7 @@ void brw_set_mask_control( struct brw_compile *p, GLuint 
 value )
  
  void brw_set_saturate( struct brw_compile *p, GLuint value )
  {
 +   assert(value == 0 || value == 1);
 p-current-header.saturate = value;
  }

Eesh.  It sounds like what you really want is:

#include stdbool.h

void
brw_set_saturate(struct brw_compile *p, bool value)
{
   p-current-header.saturate = value;
}

Then zero/non-zero would work as expected.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 13/14] i965: Advertise GLSL 1.40 and TexBOs in core contexts

2012-08-08 Thread Eric Anholt
Ian Romanick i...@freedesktop.org writes:

 From: Ian Romanick ian.d.roman...@intel.com

 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  src/mesa/drivers/dri/intel/intel_extensions.c |   10 +-
  1 files changed, 9 insertions(+), 1 deletions(-)

 diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
 b/src/mesa/drivers/dri/intel/intel_extensions.c
 index 76b56a2..10e664b 100755
 --- a/src/mesa/drivers/dri/intel/intel_extensions.c
 +++ b/src/mesa/drivers/dri/intel/intel_extensions.c
 @@ -93,7 +93,11 @@ intelInitExtensions(struct gl_context *ctx)
 ctx-Extensions.OES_compressed_ETC1_RGB8_texture = true;
  
 if (intel-gen = 6)
 -  ctx-Const.GLSLVersion = 130;
 +  if (ctx-API == API_OPENGL_CORE) {
 + ctx-Const.GLSLVersion = 140;
 +  } else {
 + ctx-Const.GLSLVersion = 130;
 +  }
 else
ctx-Const.GLSLVersion = 120;
 _mesa_override_glsl_version(ctx);
 @@ -106,6 +110,10 @@ intelInitExtensions(struct gl_context *ctx)
ctx-Extensions.ARB_blend_func_extended = 
 !driQueryOptionb(intel-optionCache, disable_blend_func_extended);
ctx-Extensions.ARB_draw_buffers_blend = true;
ctx-Extensions.ARB_uniform_buffer_object = true;
 +
 +  if (ctx-API == API_OPENGL_CORE) {
 + ctx-Extensions.ARB_texture_buffer_object = true;
 +  }

I think exposing the GL_ARB_texture_buffer_object string would imply
that we support the deprecated formats that that extension adds, which
we don't support.  I had a patch to just enable texbo functionality for
3.1 core, which I was going to polish off once I go through some
oglconform texbo fixing.

Other than that, this series seems good to me.


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


Re: [Mesa-dev] [PATCH 14/14] i965: Allow creation of OpenGL 3.1 contexts

2012-08-08 Thread Eric Anholt
Ian Romanick i...@freedesktop.org writes:

 From: Ian Romanick ian.d.roman...@intel.com

 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  src/mesa/drivers/dri/i965/brw_context.c |   19 +++
  1 files changed, 19 insertions(+), 0 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
 b/src/mesa/drivers/dri/i965/brw_context.c
 index 013ec14..990b467 100644
 --- a/src/mesa/drivers/dri/i965/brw_context.c
 +++ b/src/mesa/drivers/dri/i965/brw_context.c
 @@ -108,6 +108,25 @@ brwCreateContext(int api,
 case API_OPENGLES:
 case API_OPENGLES2:
break;
 +   case API_OPENGL_CORE: {
 +#ifdef TEXTURE_FLOAT_ENABLED
 +  const unsigned max_version =
 + (screen-gen == 6 ||
 +  (screen-gen == 7  screen-kernel_has_gen7_sol_reset))
 + ? 0x301 : 0;
 +#else
 +  const unsigned max_version = 0;
 +#endif
 +  const unsigned req_version = (major_version  8) | minor_version;
 +
 +  if (req_version  max_version) {
 + *error = (max_version == 0)
 +? __DRI_CTX_ERROR_BAD_API : __DRI_CTX_ERROR_BAD_VERSION;
 + return false;
 +  }

I'd slightly prefer seeing this version handling use major*10+minor like
ctx-Version.


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


Re: [Mesa-dev] [PATCH 2/3] i965: Drop the confusing saturate argument to math instruction setup.

2012-08-08 Thread Kenneth Graunke
On 08/08/2012 03:08 PM, Eric Anholt wrote:
 This was ridiculous.  We were ignoring the inst-header.saturate flag in the
 case of math and only math.  On gen4, we would leave inst-header.saturate in
 place if it happened to be set, which would end up being applied to the
 implicit mov and thus trash the first argument.  On gen6, we would overwrite
 inst-header.saturate with the saturate flag from the argument, which was not
 set appropriately in brw_vec4_emit.cpp, and was only not a bug due to our
 incompetence at coalescing saturate moves.
 
 By ripping the argument out and making saturate work just like all the other
 brw_eu_emit.c code generation, we can avoid both these classes of bugs.
 
 Fixes piglit fog-modes, and the new specific fs-saturate-exp2 case.
 
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48628
 NOTE: This is a candidate for the 8.0 branch.
 ---
  src/mesa/drivers/dri/i965/brw_eu.h  |2 --
  src/mesa/drivers/dri/i965/brw_eu_emit.c |   14 --
  src/mesa/drivers/dri/i965/brw_eu_util.c |1 -
  src/mesa/drivers/dri/i965/brw_fs_emit.cpp   |   10 --
  src/mesa/drivers/dri/i965/brw_sf_emit.c |2 --
  src/mesa/drivers/dri/i965/brw_vec4_emit.cpp |3 ---
  src/mesa/drivers/dri/i965/brw_vs_emit.c |3 ---
  src/mesa/drivers/dri/i965/brw_wm_emit.c |   15 ++-
  8 files changed, 6 insertions(+), 44 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
 b/src/mesa/drivers/dri/i965/brw_eu.h
 index 233b94c..6cab32d 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu.h
 +++ b/src/mesa/drivers/dri/i965/brw_eu.h
 @@ -975,7 +975,6 @@ void brw_SAMPLE(struct brw_compile *p,
  void brw_math_16( struct brw_compile *p,
 struct brw_reg dest,
 GLuint function,
 -   GLuint saturate,
 GLuint msg_reg_nr,
 struct brw_reg src,
 GLuint precision );
 @@ -983,7 +982,6 @@ void brw_math_16( struct brw_compile *p,
  void brw_math( struct brw_compile *p,
  struct brw_reg dest,
  GLuint function,
 -GLuint saturate,
  GLuint msg_reg_nr,
  struct brw_reg src,
  GLuint data_type,
 diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
 b/src/mesa/drivers/dri/i965/brw_eu_emit.c
 index 25bf91b..b82a858 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
 +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
 @@ -429,7 +429,6 @@ static void brw_set_math_message( struct brw_compile *p,
 GLuint function,
 GLuint integer_type,
 bool low_precision,
 -   bool saturate,
 GLuint dataType )
  {
 struct brw_context *brw = p-brw;
 @@ -461,22 +460,24 @@ static void brw_set_math_message( struct brw_compile *p,
break;
 }
  
 +
 brw_set_message_descriptor(p, insn, BRW_SFID_MATH,
 msg_length, response_length, false, false);
 if (intel-gen == 5) {
insn-bits3.math_gen5.function = function;
insn-bits3.math_gen5.int_type = integer_type;
insn-bits3.math_gen5.precision = low_precision;
 -  insn-bits3.math_gen5.saturate = saturate;
 +  insn-bits3.math_gen5.saturate = insn-header.saturate;
insn-bits3.math_gen5.data_type = dataType;
insn-bits3.math_gen5.snapshot = 0;
 } else {
insn-bits3.math.function = function;
insn-bits3.math.int_type = integer_type;
insn-bits3.math.precision = low_precision;
 -  insn-bits3.math.saturate = saturate;
 +  insn-bits3.math.saturate = insn-header.saturate;
insn-bits3.math.data_type = dataType;
 }
 +   insn-header.saturate = 0;
  }
  
  
 @@ -1657,7 +1658,6 @@ void brw_WAIT (struct brw_compile *p)
  void brw_math( struct brw_compile *p,
  struct brw_reg dest,
  GLuint function,
 -GLuint saturate,
  GLuint msg_reg_nr,
  struct brw_reg src,
  GLuint data_type,
 @@ -1693,7 +1693,6 @@ void brw_math( struct brw_compile *p,
 * becomes FC[3:0] and ThreadCtrl becomes FC[5:4].
 */
insn-header.destreg__conditionalmod = function;
 -  insn-header.saturate = saturate;
  
brw_set_dest(p, insn, dest);
brw_set_src0(p, insn, src);
 @@ -1714,7 +1713,6 @@ void brw_math( struct brw_compile *p,
  function,
  src.type == BRW_REGISTER_TYPE_D,
  precision,
 -saturate,
  data_type);
 }
  }
 @@ -1779,7 +1777,6 @@ void brw_math2(struct brw_compile *p,
  void brw_math_16( struct brw_compile *p,
 struct brw_reg dest,
 GLuint function,
 -   GLuint saturate,
 GLuint msg_reg_nr,
 struct brw_reg src,
  

Re: [Mesa-dev] [PATCH] intel: use _mesa_meta_Clear with OpenGL ES 1.1 v2

2012-08-08 Thread Eric Anholt
Tapani Pälli tapani.pa...@intel.com writes:

 Patch changes i915 and i965 drivers to use fixed function version of
 meta clear when running on ES 1.1. This fixes rendering errors seen with
 Google Maps, Angry Birds and Gallery3D on Android platform.

 Change 88128516d43be5d25288ff5b64db63cda83c04b3 exposes all extensions
 internally to be available independent of GL flavour, therefore check
 against ARB_fragment_shader does not work.

 Signed-off-by: Tapani Pälli tapani.pa...@intel.com
 Reviewed-by: Kenneth Graunke kenn...@whitecape.org
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50333
 ---
  src/mesa/drivers/dri/i915/intel_clear.c | 6 +++---
  src/mesa/drivers/dri/i965/brw_clear.c   | 7 ++-
  2 files changed, 9 insertions(+), 4 deletions(-)

 diff --git a/src/mesa/drivers/dri/i915/intel_clear.c 
 b/src/mesa/drivers/dri/i915/intel_clear.c
 index 96d9c8f..ebac0f5 100644
 --- a/src/mesa/drivers/dri/i915/intel_clear.c
 +++ b/src/mesa/drivers/dri/i915/intel_clear.c
 @@ -179,10 +179,10 @@ intelClear(struct gl_context *ctx, GLbitfield mask)
  
 if (tri_mask) {
debug_mask(tri, tri_mask);
 -  if (ctx-Extensions.ARB_fragment_shader)
 -  _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
 -  else
 +  if (ctx-API == API_OPENGLES)
_mesa_meta_Clear(intel-ctx, tri_mask);
 +  else
 +  _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
 }
  }
  
 diff --git a/src/mesa/drivers/dri/i965/brw_clear.c 
 b/src/mesa/drivers/dri/i965/brw_clear.c
 index 31c2e45..81b7a12 100644
 --- a/src/mesa/drivers/dri/i965/brw_clear.c
 +++ b/src/mesa/drivers/dri/i965/brw_clear.c
 @@ -226,7 +226,12 @@ brw_clear(struct gl_context *ctx, GLbitfield mask)
 if (tri_mask) {
debug_mask(tri, tri_mask);
mask = ~tri_mask;
 -  _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
 +
 +  if(ctx-API == API_OPENGLES) {
 + _mesa_meta_Clear(intel-ctx, tri_mask);
 +  } else {
 + _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
 +  }
 }

We put spaces between if and (

Other than that,

Reviewed-by: Eric Anholt e...@anholt.net


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


[Mesa-dev] [Bug 52962] gbm.c:54:4: error: implicit declaration of function ‘pipe_loader_drm_probe_fd’

2012-08-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=52962

--- Comment #1 from Chí-Thanh Christopher Nguyễn chith...@gentoo.org 
2012-08-08 22:36:02 UTC ---
Patch was sent for review:
http://lists.freedesktop.org/archives/mesa-dev/2012-August/025278.html

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- 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] [PATCH 1/3] i965: Add a safety check for brw_set_saturate().

2012-08-08 Thread Eric Anholt
Kenneth Graunke kenn...@whitecape.org writes:

 On 08/08/2012 03:08 PM, Eric Anholt wrote:
 There is an easy chance for bugs in brw_wm_emit.c, where you would pass 1  
 5
 instead of 1, which would get truncated to 0.
 ---
  src/mesa/drivers/dri/i965/brw_eu.c |1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_eu.c 
 b/src/mesa/drivers/dri/i965/brw_eu.c
 index 2c432a9..7697d08 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu.c
 +++ b/src/mesa/drivers/dri/i965/brw_eu.c
 @@ -143,6 +143,7 @@ void brw_set_mask_control( struct brw_compile *p, GLuint 
 value )
  
  void brw_set_saturate( struct brw_compile *p, GLuint value )
  {
 +   assert(value == 0 || value == 1);
 p-current-header.saturate = value;
  }

 Eesh.  It sounds like what you really want is:

 #include stdbool.h

 void
 brw_set_saturate(struct brw_compile *p, bool value)
 {
p-current-header.saturate = value;
 }

 Then zero/non-zero would work as expected.

Oh, cool.  I hadn't realized that stdbool actually did nonzero - true
conversion exactly the way we want, which is why I hadn't just done this.


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


Re: [Mesa-dev] [PATCH 1/3] i965: Add a safety check for brw_set_saturate().

2012-08-08 Thread Eric Anholt
Eric Anholt e...@anholt.net writes:

 Kenneth Graunke kenn...@whitecape.org writes:

 On 08/08/2012 03:08 PM, Eric Anholt wrote:
 There is an easy chance for bugs in brw_wm_emit.c, where you would pass 1 
  5
 instead of 1, which would get truncated to 0.
 ---
  src/mesa/drivers/dri/i965/brw_eu.c |1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_eu.c 
 b/src/mesa/drivers/dri/i965/brw_eu.c
 index 2c432a9..7697d08 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu.c
 +++ b/src/mesa/drivers/dri/i965/brw_eu.c
 @@ -143,6 +143,7 @@ void brw_set_mask_control( struct brw_compile *p, 
 GLuint value )
  
  void brw_set_saturate( struct brw_compile *p, GLuint value )
  {
 +   assert(value == 0 || value == 1);
 p-current-header.saturate = value;
  }

 Eesh.  It sounds like what you really want is:

 #include stdbool.h

 void
 brw_set_saturate(struct brw_compile *p, bool value)
 {
p-current-header.saturate = value;
 }

 Then zero/non-zero would work as expected.

 Oh, cool.  I hadn't realized that stdbool actually did nonzero - true
 conversion exactly the way we want, which is why I hadn't just done this.

Good point, I hadn't realized the int - bool conversion worked the way
you would hope.  I've switched the first commit to do that, but I left
the to-be-merged-to-8.0 one as-is with != 0 comparisons, since it's
stylistically consistent with the rest of the file.


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


Re: [Mesa-dev] [PATCH 8/8] i965: Add perf debug for stalls during shader compiles.

2012-08-08 Thread Kenneth Graunke
On 08/07/2012 11:04 AM, Eric Anholt wrote:
 ---
  src/mesa/drivers/dri/i965/brw_fs.cpp|   13 +
  src/mesa/drivers/dri/i965/brw_vec4_emit.cpp |   20 ++--
  src/mesa/drivers/dri/intel/intel_screen.c   |   13 +
  src/mesa/drivers/dri/intel/intel_screen.h   |1 +
  4 files changed, 45 insertions(+), 2 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs.cpp
 index 90a1d92..dfd101f 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
 @@ -2044,10 +2044,18 @@ brw_wm_fs_emit(struct brw_context *brw, struct 
 brw_wm_compile *c,
  struct gl_shader_program *prog)
  {
 struct intel_context *intel = brw-intel;
 +   bool start_busy = false;
 +   float start_time = 0;
  
 if (!prog)
return false;
  
 +   if (unlikely(INTEL_DEBUG  DEBUG_PERF)) {
 +  start_busy = (intel-batch.last_bo 
 +drm_intel_bo_busy(intel-batch.last_bo));
 +  start_time = get_time();
 +   }
 +
 struct brw_shader *shader =
   (brw_shader *) prog-_LinkedShaders[MESA_SHADER_FRAGMENT];
 if (!shader)
 @@ -2090,6 +2098,11 @@ brw_wm_fs_emit(struct brw_context *brw, struct 
 brw_wm_compile *c,
if (shader-compiled_once)
   brw_wm_debug_recompile(brw, prog, c-key);
shader-compiled_once = true;
 +
 +  if (start_busy  !drm_intel_bo_busy(intel-batch.last_bo)) {
 + perf_debug(FS compile took %.03f ms and stalled the GPU\n,
 +(get_time() - start_time) / 1000);
 +  }
 }
  
 return true;
 diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp 
 b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
 index 788d7b5..0db435b 100644
 --- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
 @@ -1017,9 +1017,19 @@ extern C {
  bool
  brw_vs_emit(struct gl_shader_program *prog, struct brw_vs_compile *c)
  {
 +   struct intel_context *intel = c-func.brw-intel;
 +   bool start_busy = false;
 +   float start_time = 0;
 +
 if (!prog)
return false;
  
 +   if (unlikely(INTEL_DEBUG  DEBUG_PERF)) {
 +  start_busy = (intel-batch.last_bo 
 +drm_intel_bo_busy(intel-batch.last_bo));
 +  start_time = get_time();
 +   }
 +
 struct brw_shader *shader =
   (brw_shader *) prog-_LinkedShaders[MESA_SHADER_VERTEX];
 if (!shader)
 @@ -1031,8 +1041,14 @@ brw_vs_emit(struct gl_shader_program *prog, struct 
 brw_vs_compile *c)
printf(\n\n);
 }
  
 -   if (shader-compiled_once) {
 -  perf_debug(Recompiling vertex shader for program %d\n, prog-Name);
 +   if (unlikely(INTEL_DEBUG  DEBUG_PERF)) {
 +  if (shader-compiled_once) {
 + perf_debug(Recompiling vertex shader for program %d\n, 
 prog-Name);
 +  }
 +  if (start_busy  !drm_intel_bo_busy(intel-batch.last_bo)) {
 + perf_debug(VS compile took %.03f ms and stalled the GPU\n,
 +(get_time() - start_time) / 1000);
 +  }
 }
  
 vec4_visitor v(c, prog, shader);
 diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
 b/src/mesa/drivers/dri/intel/intel_screen.c
 index 5c38c8d..56abc12 100644
 --- a/src/mesa/drivers/dri/intel/intel_screen.c
 +++ b/src/mesa/drivers/dri/intel/intel_screen.c
 @@ -109,6 +109,19 @@ const GLuint __driNConfigOptions = 15;
  static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
  #endif /*USE_NEW_INTERFACE */
  
 +/**
 + * For debugging, this returns a time in seconds since the first call.
 + */

Doesn't seem to be since the first call.

Otherwise, this series looks great!  It'll be extremely useful.
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

 +double
 +get_time(void)
 +{
 +   struct timespec tp;
 +
 +   clock_gettime(CLOCK_MONOTONIC, tp);
 +
 +   return tp.tv_sec + tp.tv_nsec / 10.0;
 +}
 +
  void
  aub_dump_bmp(struct gl_context *ctx)
  {
 diff --git a/src/mesa/drivers/dri/intel/intel_screen.h 
 b/src/mesa/drivers/dri/intel/intel_screen.h
 index c0cc284..f5a374d 100644
 --- a/src/mesa/drivers/dri/intel/intel_screen.h
 +++ b/src/mesa/drivers/dri/intel/intel_screen.h
 @@ -81,6 +81,7 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
   __DRIdrawable * driDrawPriv,
   __DRIdrawable * driReadPriv);
  
 +double get_time(void);
  void aub_dump_bmp(struct gl_context *ctx);
  
  #endif
 

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


Re: [Mesa-dev] [PATCH 1/5] i965/fs: Fix the FS inputs setup when some SF outputs aren't used in the FS.

2012-08-08 Thread Kenneth Graunke
On 07/28/2012 04:43 PM, Eric Anholt wrote:
 From: Olivier Galibert galib...@pobox.com
 
 If there was an edge flag or a two-side-color pair present, we'd end up
 mismatched and read values from earlier in the VUE for later FS inputs.
 
 v2: Fix regression in gles2conform shaders generating point size. (change by
 anholt)
 
 Signed-off-by: Olivier Galibert galib...@pobox.com
 Reviewed-by: Eric Anholt e...@anholt.net
 NOTE: This is a candidate for the 8.0 branch.

Series looks fine to me.
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

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


Re: [Mesa-dev] [PATCH 14/14] i965: Allow creation of OpenGL 3.1 contexts

2012-08-08 Thread Jordan Justen
For series:
Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

On Wed, Aug 8, 2012 at 10:38 AM, Ian Romanick i...@freedesktop.org wrote:
 From: Ian Romanick ian.d.roman...@intel.com

 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  src/mesa/drivers/dri/i965/brw_context.c |   19 +++
  1 files changed, 19 insertions(+), 0 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
 b/src/mesa/drivers/dri/i965/brw_context.c
 index 013ec14..990b467 100644
 --- a/src/mesa/drivers/dri/i965/brw_context.c
 +++ b/src/mesa/drivers/dri/i965/brw_context.c
 @@ -108,6 +108,25 @@ brwCreateContext(int api,
 case API_OPENGLES:
 case API_OPENGLES2:
break;
 +   case API_OPENGL_CORE: {
 +#ifdef TEXTURE_FLOAT_ENABLED
 +  const unsigned max_version =
 + (screen-gen == 6 ||
 +  (screen-gen == 7  screen-kernel_has_gen7_sol_reset))
 + ? 0x301 : 0;
 +#else
 +  const unsigned max_version = 0;
 +#endif
 +  const unsigned req_version = (major_version  8) | minor_version;
 +
 +  if (req_version  max_version) {
 + *error = (max_version == 0)
 +? __DRI_CTX_ERROR_BAD_API : __DRI_CTX_ERROR_BAD_VERSION;
 + return false;
 +  }
 +
 +  break;
 +   }
 default:
*error = __DRI_CTX_ERROR_BAD_API;
return false;
 --
 1.7.6.5

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


[Mesa-dev] [Bug 44912] [bisected] WebGL conformance/textures/texture-mips tests fails

2012-08-08 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44912

--- Comment #5 from Benoit Jacob bja...@mozilla.com 2012-08-09 02:48:31 UTC 
---
Forget comment 2, I dont have any idea of how to work around this driver bug,
and it works in other drivers. Really hope for a driver fix here. This is the
last WebGL 1.0.1 conformance test page failing with the r600g driver. It passes
with the Intel driver on Mesa 8.0.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- 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] intel: use _mesa_meta_Clear with OpenGL ES 1.1 v3

2012-08-08 Thread Tapani Pälli
Patch changes i915 and i965 drivers to use fixed function version of
meta clear when running on ES 1.1. This fixes rendering errors seen with
Google Maps, Angry Birds and Gallery3D on Android platform.

Change 88128516d43be5d25288ff5b64db63cda83c04b3 exposes all extensions
internally to be available independent of GL flavour, therefore check
against ARB_fragment_shader does not work.

Signed-off-by: Tapani Pälli tapani.pa...@intel.com
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Eric Anholt e...@anholt.net
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50333
---
 src/mesa/drivers/dri/i915/intel_clear.c | 6 +++---
 src/mesa/drivers/dri/i965/brw_clear.c   | 7 ++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_clear.c 
b/src/mesa/drivers/dri/i915/intel_clear.c
index 96d9c8f..ebac0f5 100644
--- a/src/mesa/drivers/dri/i915/intel_clear.c
+++ b/src/mesa/drivers/dri/i915/intel_clear.c
@@ -179,10 +179,10 @@ intelClear(struct gl_context *ctx, GLbitfield mask)
 
if (tri_mask) {
   debug_mask(tri, tri_mask);
-  if (ctx-Extensions.ARB_fragment_shader)
-_mesa_meta_glsl_Clear(intel-ctx, tri_mask);
-  else
+  if (ctx-API == API_OPENGLES)
 _mesa_meta_Clear(intel-ctx, tri_mask);
+  else
+_mesa_meta_glsl_Clear(intel-ctx, tri_mask);
}
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_clear.c 
b/src/mesa/drivers/dri/i965/brw_clear.c
index 31c2e45..05dd68b 100644
--- a/src/mesa/drivers/dri/i965/brw_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_clear.c
@@ -226,7 +226,12 @@ brw_clear(struct gl_context *ctx, GLbitfield mask)
if (tri_mask) {
   debug_mask(tri, tri_mask);
   mask = ~tri_mask;
-  _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
+
+  if (ctx-API == API_OPENGLES) {
+ _mesa_meta_Clear(intel-ctx, tri_mask);
+  } else {
+ _mesa_meta_glsl_Clear(intel-ctx, tri_mask);
+  }
}
 
/* Any strange buffers get passed off to swrast */
-- 
1.7.11.2

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