Mesa (7.9): glapi: Fix build errors for ES.

2010-09-16 Thread Chia-I Wu
Module: Mesa
Branch: 7.9
Commit: 16a023ad7d5517439732e8186eb2f7f8a78d7a45
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=16a023ad7d5517439732e8186eb2f7f8a78d7a45

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Sep 15 17:43:21 2010 +0800

glapi: Fix build errors for ES.

The latest glext.h defines GL_FIXED.  Test GL_OES_fixed_point instead to
decide whether to define GLfixed and GLclampx.

This fixes fdo bug #30205.
(cherry picked from commit cad87ebc3a9c176a44f5193af7e16d6ecad4e03f)

---

 src/mapi/glapi/glapi_priv.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h
index 89f81c7..3ab553a 100644
--- a/src/mapi/glapi/glapi_priv.h
+++ b/src/mapi/glapi/glapi_priv.h
@@ -38,7 +38,7 @@
 #include GL/gl.h
 #include GL/glext.h
 
-#ifndef GL_FIXED
+#ifndef GL_OES_fixed_point
 typedef int GLfixed;
 typedef int GLclampx;
 #endif

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


Mesa (7.9): glapi: Fix ES build errors again.

2010-09-16 Thread Chia-I Wu
Module: Mesa
Branch: 7.9
Commit: d6538baa3b5b7a6a926ebf6af8e1986d21d3ef67
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d6538baa3b5b7a6a926ebf6af8e1986d21d3ef67

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Sep 15 21:12:38 2010 +0800

glapi: Fix ES build errors again.

This fixes an error in GLAPI ES.  My build is ok with or without this
patch, and the error affects others' setups.

[Patch from Francesco Marella]
(cherry picked from commit e3c46cf58684785ab16862548d6806227f0bdd21)

---

 src/mapi/glapi/gen-es/es_EXT.xml |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/gen-es/es_EXT.xml b/src/mapi/glapi/gen-es/es_EXT.xml
index 113d8d7..0013df8 100644
--- a/src/mapi/glapi/gen-es/es_EXT.xml
+++ b/src/mapi/glapi/gen-es/es_EXT.xml
@@ -106,8 +106,8 @@
 category name=GL_EXT_multi_draw_arrays number=69
 function name=MultiDrawArraysEXT offset=assign
 param name=mode type=GLenum/
-param name=first type=GLint */ !-- Spec bug. Should be const. 
--
-param name=count type=GLsizei */ !-- Spec bug. Should be const. 
--
+param name=first type=const GLint */
+param name=count type=const GLsizei */
 param name=primcount type=GLsizei/
 glx handcode=true/
 /function

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


Mesa (7.9): mesa: Update ES APIspec.xml.

2010-09-16 Thread Chia-I Wu
Module: Mesa
Branch: 7.9
Commit: e3b89388ff98ce849877e28d6cb1631cacc5329c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e3b89388ff98ce849877e28d6cb1631cacc5329c

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Sep 15 22:37:40 2010 +0800

mesa: Update ES APIspec.xml.

Enable some extensions now that the needed tokens are defined in
GLES/glext.h and GLES2/glext.h.  Update the prototype of MultiDrawArrays
now that the prototype of _mesa_MultiDrawArraysEXT has been updated.
(cherry picked from commit 9ca59b2427837b8a70b580d66b4909e5f8443945)

---

 src/mesa/main/APIspec.xml |   14 +-
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index b4ed18e..4c5fd59 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -1701,8 +1701,7 @@
desc name=type
value name=GL_UNSIGNED_BYTE/
value name=GL_UNSIGNED_SHORT/
-   !-- GL_UNSIGNED_INT is not defined in GLES1.1 headers --
-   value name=(0x1405 /* GL_UNSIGNED_INT */) 
category=OES_element_index_uint/
+   value name=GL_UNSIGNED_INT 
category=OES_element_index_uint/
/desc
 /template
 
@@ -3458,8 +3457,8 @@
proto
return type=void/
param name=mode type=GLenum/
-   param name=first type=GLint */
-   param name=count type=GLsizei */
+   param name=first type=const GLint */
+   param name=count type=const GLsizei */
param name=primcount type=GLsizei/
/proto
 
@@ -3497,8 +3496,7 @@
desc name=type
value name=GL_UNSIGNED_BYTE/
value name=GL_UNSIGNED_SHORT/
-   !-- GL_UNSIGNED_INT is not defined in GLES1.1 headers --
-   value name=(0x1405 /* GL_UNSIGNED_INT */) 
category=OES_element_index_uint/
+   value name=GL_UNSIGNED_INT 
category=OES_element_index_uint/
/desc
 /template
 
@@ -3836,9 +3834,9 @@
category name=ARB_texture_non_power_of_two/
!-- disabled due to missing enums
category name=EXT_texture_compression_dxt1/
+   --
category name=EXT_texture_lod_bias/
category name=EXT_blend_minmax/
-   --
category name=EXT_multi_draw_arrays/
category name=OES_EGL_image/
 
@@ -4124,10 +4122,8 @@
category name=OES_packed_depth_stencil/
category name=OES_standard_derivatives/
 
-   !-- disabled due to missing enums
category name=EXT_texture_compression_dxt1/
category name=EXT_blend_minmax/
-   --
category name=EXT_multi_draw_arrays/
category name=OES_EGL_image/
 

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


Mesa (7.9): st/xlib: Notify the context when the front/ back buffers are swapped.

2010-09-16 Thread Chia-I Wu
Module: Mesa
Branch: 7.9
Commit: 5d02503467f8caf0dfadce5512e2e9de48e24fdc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d02503467f8caf0dfadce5512e2e9de48e24fdc

Author: Chia-I Wu o...@lunarg.com
Date:   Wed Sep  8 00:30:27 2010 +0800

st/xlib: Notify the context when the front/back buffers are swapped.

The current context should be notified when the the front/back buffers
of the current drawable are swapped.  The notification was skipped when
xmesa_strict_invalidate is false (the default).

This fixes fdo bug #29774.
(cherry picked from commit 03224f492dc9cee179ff9ed961be0443a3669dd1)

---

 src/gallium/state_trackers/glx/xlib/xm_api.c |   18 ++
 src/gallium/state_trackers/glx/xlib/xm_api.h |3 +++
 src/gallium/state_trackers/glx/xlib/xm_st.c  |4 
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c 
b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 36d63c3..f950c88 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -1087,19 +1087,29 @@ XMesaDestroyBuffer(XMesaBuffer b)
 
 
 /**
- * Query the current drawable size and notify the binding context.
+ * Notify the binding context to validate the buffer.
  */
 void
-xmesa_check_buffer_size(XMesaBuffer b)
+xmesa_notify_invalid_buffer(XMesaBuffer b)
 {
XMesaContext xmctx = XMesaGetCurrentContext();
 
+   if (xmctx  xmctx-xm_buffer == b)
+  xmctx-st-notify_invalid_framebuffer(xmctx-st, b-stfb);
+}
+
+
+/**
+ * Query the current drawable size and notify the binding context.
+ */
+void
+xmesa_check_buffer_size(XMesaBuffer b)
+{
if (b-type == PBUFFER)
   return;
 
xmesa_get_window_size(b-xm_visual-display, b, b-width, b-height);
-   if (xmctx  xmctx-xm_buffer == b)
-  xmctx-st-notify_invalid_framebuffer(xmctx-st, b-stfb);
+   xmesa_notify_invalid_buffer(b);
 }
 
 
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h 
b/src/gallium/state_trackers/glx/xlib/xm_api.h
index f209b14..fedf2b2 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.h
@@ -361,6 +361,9 @@ xmesa_get_window_size(Display *dpy, XMesaBuffer b,
   GLuint *width, GLuint *height);
 
 extern void
+xmesa_notify_invalid_buffer(XMesaBuffer b);
+
+extern void
 xmesa_check_buffer_size(XMesaBuffer b);
 
 extern void
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c 
b/src/gallium/state_trackers/glx/xlib/xm_st.c
index 4c0ce07..4d0f5e6 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -339,6 +339,10 @@ xmesa_swap_st_framebuffer(struct st_framebuffer_iface 
*stfbi)
  tmp = *front;
  *front = *back;
  *back = tmp;
+
+ /* the current context should validate the buffer after swapping */
+ if (!xmesa_strict_invalidate)
+xmesa_notify_invalid_buffer(xstfb-buffer);
   }
 
   if (xmesa_strict_invalidate)

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


Mesa (7.9): glx: add const qualifiers to __indirect_glMultiDrawArraysEXT()

2010-09-16 Thread Chia-I Wu
Module: Mesa
Branch: 7.9
Commit: d46b7c9f6f91f80b7349067dd5be52f0af736ec1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d46b7c9f6f91f80b7349067dd5be52f0af736ec1

Author: Brian Paul bri...@vmware.com
Date:   Tue Sep 14 11:01:03 2010 -0600

glx: add const qualifiers to __indirect_glMultiDrawArraysEXT()
(cherry picked from commit 4cd751bcc48798f19b089f6cff58bfca2f18fe36)

---

 src/glx/indirect_vertex_array.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glx/indirect_vertex_array.c b/src/glx/indirect_vertex_array.c
index 372618d..115f755 100644
--- a/src/glx/indirect_vertex_array.c
+++ b/src/glx/indirect_vertex_array.c
@@ -1034,8 +1034,8 @@ __indirect_glDrawRangeElements(GLenum mode, GLuint start, 
GLuint end,
 
 
 void
-__indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count,
-GLsizei primcount)
+__indirect_glMultiDrawArraysEXT(GLenum mode, const GLint *first,
+const GLsizei *count, GLsizei primcount)
 {
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =

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


Mesa (master): r600g: Fixed a bo leak in r600_blit_state_ps_shader().

2010-09-16 Thread Tilman Sauerbeck
Module: Mesa
Branch: master
Commit: 2108caac25b375cfa6943fcc6a6386b9a8d4655e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2108caac25b375cfa6943fcc6a6386b9a8d4655e

Author: Tilman Sauerbeck til...@code-monkey.de
Date:   Fri Sep 10 15:20:15 2010 +0200

r600g: Fixed a bo leak in r600_blit_state_ps_shader().

We would leak the newly created bo if it cannot be mapped.

Signed-off-by: Tilman Sauerbeck til...@code-monkey.de

---

 src/gallium/drivers/r600/r600_blit.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_blit.c 
b/src/gallium/drivers/r600/r600_blit.c
index e6ded34..e6b3be6 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -335,10 +335,10 @@ static void r600_blit_state_ps_shader(struct r600_screen 
*rscreen, struct radeon
/* simple shader */
bo = radeon_bo(rscreen-rw, 0, 128, 4096, NULL);
if (bo == NULL) {
-   radeon_bo_decref(rscreen-rw, bo);
return;
}
if (radeon_bo_map(rscreen-rw, bo)) {
+   radeon_bo_decref(rscreen-rw, bo);
return;
}
switch (rscreen-chip_class) {

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


Mesa (master): r600g: Use clamped math for RCP and RSQ.

2010-09-16 Thread Tilman Sauerbeck
Module: Mesa
Branch: master
Commit: df62338c491f2cace1a48f99de78e83b5edd82fd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=df62338c491f2cace1a48f99de78e83b5edd82fd

Author: Tilman Sauerbeck til...@code-monkey.de
Date:   Fri Sep 10 18:24:01 2010 +0200

r600g: Use clamped math for RCP and RSQ.

This is likely only correct for OpenGL and not other state trackers.

Signed-off-by: Tilman Sauerbeck til...@code-monkey.de

---

 src/gallium/drivers/r600/r600_shader.c |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 0453138..ad19238 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1129,7 +1129,13 @@ static int tgsi_rsq(struct r600_shader_ctx *ctx)
int i, r;
 
memset(alu, 0, sizeof(struct r600_bc_alu));
-   alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE);
+
+   /* FIXME:
+* For state trackers other than OpenGL, we'll want to use
+* _RECIPSQRT_IEEE instead.
+*/
+   alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED);
+
for (i = 0; i  inst-Instruction.NumSrcRegs; i++) {
r = tgsi_src(ctx, inst-Src[i], alu.src[i]);
if (r)
@@ -2633,7 +2639,13 @@ static struct r600_shader_tgsi_instruction 
r600_shader_tgsi_instruction[] = {
{TGSI_OPCODE_ARL,   0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, 
tgsi_arl},
{TGSI_OPCODE_MOV,   0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, 
tgsi_op2},
{TGSI_OPCODE_LIT,   0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, 
tgsi_lit},
-   {TGSI_OPCODE_RCP,   0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE, 
tgsi_trans_srcx_replicate},
+
+   /* FIXME:
+* For state trackers other than OpenGL, we'll want to use
+* _RECIP_IEEE instead.
+*/
+   {TGSI_OPCODE_RCP,   0, 
V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED, tgsi_trans_srcx_replicate},
+
{TGSI_OPCODE_RSQ,   0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, 
tgsi_rsq},
{TGSI_OPCODE_EXP,   0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, 
tgsi_exp},
{TGSI_OPCODE_LOG,   0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, 
tgsi_log},

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


Mesa (master): glsl: Change from has_builtin_signature to has_user_signature.

2010-09-16 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 81f03393982c29f8f4165b5629c8e8fb708b97a3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=81f03393982c29f8f4165b5629c8e8fb708b97a3

Author: Kenneth Graunke kenn...@whitecape.org
Date:   Thu Sep 16 02:52:25 2010 -0700

glsl: Change from has_builtin_signature to has_user_signature.

The print visitor needs this, and the only existing user can work with
has_user_signature just as well.

---

 src/glsl/ast_to_hir.cpp |2 +-
 src/glsl/ir.cpp |4 ++--
 src/glsl/ir.h   |4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 31bb40d..9638544 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2285,7 +2285,7 @@ ast_function::hir(exec_list *instructions,
 * that the previously seen signature does not have an associated 
definition.
 */
f = state-symbols-get_function(name);
-   if (f != NULL  (state-es_shader || !f-has_builtin_signature())) {
+   if (f != NULL  (state-es_shader || f-has_user_signature())) {
   sig = f-exact_matching_signature(hir_parameters);
   if (sig != NULL) {
 const char *badvar = sig-qualifiers_match(hir_parameters);
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 86dc490..7cc55d4 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1137,11 +1137,11 @@ ir_function::ir_function(const char *name)
 
 
 bool
-ir_function::has_builtin_signature()
+ir_function::has_user_signature()
 {
foreach_list(n, this-signatures) {
   ir_function_signature *const sig = (ir_function_signature *) n;
-  if (sig-is_builtin)
+  if (!sig-is_builtin)
 return true;
}
return false;
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 70c6faa..b3b15bb 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -410,8 +410,8 @@ public:
 */
const char *name;
 
-   /** Whether or not this function has a signature that is a built-in. */
-   bool has_builtin_signature();
+   /** Whether or not this function has a signature that isn't a built-in. */
+   bool has_user_signature();
 
/**
 * List of ir_function_signature for each overloaded function with this 
name.

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


Mesa (master): glsl: Don't print blank (function ...) headers for built-ins .

2010-09-16 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 8fbe968a62f845da2a1491c398acf0b2140d2372
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8fbe968a62f845da2a1491c398acf0b2140d2372

Author: Kenneth Graunke kenn...@whitecape.org
Date:   Thu Sep 16 02:55:02 2010 -0700

glsl: Don't print blank (function ...) headers for built-ins.

Fixes a regression caused when I added my GLSL ES support.

---

 src/glsl/ir_print_visitor.cpp |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index eff950e..5c19db1 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -153,6 +153,9 @@ void ir_print_visitor::visit(ir_function_signature *ir)
 
 void ir_print_visitor::visit(ir_function *ir)
 {
+   if (!ir-has_user_signature())
+  return;
+
printf((function %s\n, ir-name);
indentation++;
foreach_iter(exec_list_iterator, iter, *ir) {

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


Mesa (master): nv50: don't segfault on shaders with 0 instructions

2010-09-16 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: e0aa7e043803b10f503440ed088d89b67f5fd66f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0aa7e043803b10f503440ed088d89b67f5fd66f

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Thu Sep 16 00:51:32 2010 +0200

nv50: don't segfault on shaders with 0 instructions

---

 src/gallium/drivers/nv50/nv50_pc.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_pc.c 
b/src/gallium/drivers/nv50/nv50_pc.c
index bb464ec..6765405 100644
--- a/src/gallium/drivers/nv50/nv50_pc.c
+++ b/src/gallium/drivers/nv50/nv50_pc.c
@@ -459,7 +459,8 @@ nv50_emit_program(struct nv_pc *pc)
assert(pc-emit == code[pc-bin_size / 4]);
 
/* XXX: we can do better than this ... */
-   if (!(pc-emit[-2]  1) || (pc-emit[-2]  2) || (pc-emit[-1]  3)) {
+   if (!pc-bin_size ||
+   !(pc-emit[-2]  1) || (pc-emit[-2]  2) || (pc-emit[-1]  3)) {
   pc-emit[0] = 0xf001;
   pc-emit[1] = 0xe000;
   pc-bin_size += 8;
@@ -523,6 +524,7 @@ nv50_generate_code(struct nv50_translation_info *ti)
ret = nv_pc_exec_pass2(pc);
if (ret)
   goto out;
+   assert(!(pc-bin_size % 8));
 
pc-emit = CALLOC(pc-bin_size / 4 + 2, 4);
if (!pc-emit) {

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


Mesa (master): nv50: get shader fixups/relocations into working state

2010-09-16 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 3a62365f402b1159afd526fb4b510cdb51de1365
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a62365f402b1159afd526fb4b510cdb51de1365

Author: Christoph Bumiller e0425...@student.tuwien.ac.at
Date:   Thu Sep 16 14:47:44 2010 +0200

nv50: get shader fixups/relocations into working state

---

 src/gallium/drivers/nv50/nv50_pc.h  |   27 +
 src/gallium/drivers/nv50/nv50_pc_emit.c |   98 +-
 src/gallium/drivers/nv50/nv50_program.c |3 +
 src/gallium/drivers/nv50/nv50_program.h |5 ++
 4 files changed, 79 insertions(+), 54 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_pc.h 
b/src/gallium/drivers/nv50/nv50_pc.h
index fd2799e..2ead804 100644
--- a/src/gallium/drivers/nv50/nv50_pc.h
+++ b/src/gallium/drivers/nv50/nv50_pc.h
@@ -295,28 +295,6 @@ struct nv_basic_block {
uint32_t live_set[NV_PC_MAX_VALUES / 32];
 };
 
-#define NV_FIXUP_CFLOW_RELOC 0
-#define NV_FIXUP_PARAM_RELOC 1
-
-struct nv_fixup {
-   ubyte type;
-   ubyte shift;
-   uint32_t mask;
-   uint32_t data;
-   uint32_t offset;
-};
-
-static INLINE void
-nv_fixup_apply(uint32_t *bin, struct nv_fixup *fixup, uint32_t data)
-{
-   uint32_t val;
-
-   val = bin[fixup-offset / 4]  ~fixup-mask;
-   data = (fixup-shift  0) ? (data  fixup-shift) : (data  fixup-shift);
-   val |= (fixup-data + data)  fixup-mask;
-   bin[fixup-offset / 4] = val;
-}
-
 struct nv50_translation_info;
 
 struct nv_pc {
@@ -346,8 +324,8 @@ struct nv_pc {
unsigned bin_size;
unsigned bin_pos;
 
-   struct nv_fixup *fixups;
-   int num_fixups;
+   void *fixups;
+   unsigned num_fixups;
 
/* optimization enables */
boolean opt_reload_elim;
@@ -471,6 +449,7 @@ nv_reference(struct nv_pc *pc, struct nv_ref **d, struct 
nv_value *s)
 
 /* nv50_emit.c */
 void nv50_emit_instruction(struct nv_pc *, struct nv_instruction *);
+unsigned nv50_inst_min_size(struct nv_instruction *);
 
 /* nv50_print.c */
 const char *nv_opcode_name(uint opcode);
diff --git a/src/gallium/drivers/nv50/nv50_pc_emit.c 
b/src/gallium/drivers/nv50/nv50_pc_emit.c
index 137a531..f37dc51 100644
--- a/src/gallium/drivers/nv50/nv50_pc_emit.c
+++ b/src/gallium/drivers/nv50/nv50_pc_emit.c
@@ -23,8 +23,6 @@
 #include nv50_context.h
 #include nv50_pc.h
 
-// Definitions
-
 #define FLAGS_CC_SHIFT7
 #define FLAGS_ID_SHIFT12
 #define FLAGS_WR_ID_SHIFT 4
@@ -33,6 +31,64 @@
 #define FLAGS_WR_EN   (1  6)
 #define FLAGS_WR_ID_MASK  (0x3  FLAGS_WR_ID_SHIFT)
 
+#define NV50_FIXUP_CODE_RELOC 0
+#define NV50_FIXUP_DATA_RELOC 1
+
+struct nv50_fixup {
+   uint8_t type;
+   int8_t shift;
+   uint32_t mask;
+   uint32_t data;
+   uint32_t offset;
+};
+
+void
+nv50_relocate_program(struct nv50_program *p,
+  uint32_t code_base,
+  uint32_t data_base)
+{
+   struct nv50_fixup *f = (struct nv50_fixup *)p-fixups;
+   unsigned i;
+
+   for (i = 0; i  p-num_fixups; ++i) {
+  uint32_t data;
+
+  switch (f[i].type) {
+  case NV50_FIXUP_CODE_RELOC: data = code_base + f[i].data; break;
+  case NV50_FIXUP_DATA_RELOC: data = data_base + f[i].data; break;
+  default:
+ data = f[i].data;
+ break;
+  }
+  data = (f[i].shift  0) ? (data  -f[i].shift) : (data  f[i].shift);
+
+  p-code[f[i].offset / 4] = ~f[i].mask;
+  p-code[f[i].offset / 4] |= data  f[i].mask;
+   }
+}
+
+static void
+new_fixup(struct nv_pc *pc, uint8_t ty, int w, uint32_t data, uint32_t m, int 
s)
+{
+   struct nv50_fixup *f;
+
+   const unsigned size = sizeof(struct nv50_fixup);
+   const unsigned n = pc-num_fixups;
+
+   if (!(n % 8))
+  pc-fixups = REALLOC(pc-fixups, n * size, (n + 8) * size);
+
+   f = (struct nv50_fixup *)pc-fixups;
+
+   f[n].offset = (pc-bin_pos + w) * 4;
+   f[n].type = ty;
+   f[n].data = data;
+   f[n].mask = m;
+   f[n].shift = s;
+
+   ++pc-num_fixups;
+}
+
 const ubyte nv50_inst_min_size_tab[NV_OP_COUNT] =
 {
0, 0, 0, 8, 8, 4, 4, 4, 8, 4, 4, 8, 8, 8, 8, 8, /* 15 */
@@ -41,10 +97,6 @@ const ubyte nv50_inst_min_size_tab[NV_OP_COUNT] =
4, 8, 8, 8, 8, 8, 0, 0, 8
 };
 
-/* XXX: silence, you ! */
-unsigned
-nv50_inst_min_size(struct nv_instruction *i);
-
 unsigned
 nv50_inst_min_size(struct nv_instruction *i)
 {
@@ -159,27 +211,9 @@ set_immd(struct nv_pc *pc, struct nv_ref *ref)
set_immd_u32(pc, get_immd_u32(ref));
 }
 
-static void
-new_fixup(struct nv_pc *pc, unsigned type, uint32_t data, uint32_t m, int s)
-{
-   const unsigned size = sizeof(struct nv_fixup);
-   const unsigned n = pc-num_fixups;
-   return;
-
-   if (!(n % 8))
-  pc-fixups = REALLOC(pc-fixups, n * size, (n + 8) * size);
-
-   pc-fixups[n].offset = pc-bin_pos + (s / 32);
-   pc-fixups[n].type = type;
-   pc-fixups[n].data = data;
-   pc-fixups[n].mask = m  (s % 32);
-   pc-fixups[n].shift = s % 32;
-
-   ++pc-num_fixups;
-
-   assert(((data  (s % 32))  pc-fixups[n].mask) == (data  (s % 32)));
-}
-
+/* Allocate data in immediate buffer, if we want to load the 

Mesa (master): gallivm: fix incorrect vector shuffle datatype

2010-09-16 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 3c9f4c7b750ce7e9c60d75dbe186aaaf69e4baab
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c9f4c7b750ce7e9c60d75dbe186aaaf69e4baab

Author: Brian Paul bri...@vmware.com
Date:   Thu Sep 16 08:56:22 2010 -0600

gallivm: fix incorrect vector shuffle datatype

The permutation vector must always be a vector of int32 values.

---

 src/gallium/auxiliary/gallivm/lp_bld_swizzle.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c 
b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
index d4d2f2b..1dfbe56 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
@@ -76,11 +76,15 @@ lp_build_broadcast_scalar(struct lp_build_context *bld,
}
else {
   LLVMValueRef res;
+  /* The shuffle vector is always made of int32 elements */
+  struct lp_type i32_vec_type = lp_type_int_vec(32);
+  i32_vec_type.length = type.length;
+
 #if HAVE_LLVM = 0x207
   res = LLVMBuildInsertElement(bld-builder, bld-undef, scalar,
LLVMConstInt(LLVMInt32Type(), 0, 0), );
   res = LLVMBuildShuffleVector(bld-builder, res, bld-undef,
-   lp_build_const_int_vec(type, 0), );
+   lp_build_const_int_vec(i32_vec_type, 0), 
);
 #else
   /* XXX: The above path provokes a bug in LLVM 2.6 */
   unsigned i;

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


Mesa (master): gallivm: move i32_vec_type inside the #ifdef

2010-09-16 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 7640151c3d9692bc5e43da04dab5697692a07f86
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7640151c3d9692bc5e43da04dab5697692a07f86

Author: Brian Paul bri...@vmware.com
Date:   Thu Sep 16 09:00:54 2010 -0600

gallivm: move i32_vec_type inside the #ifdef

---

 src/gallium/auxiliary/gallivm/lp_bld_swizzle.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c 
b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
index 1dfbe56..2e9e838 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
@@ -76,11 +76,12 @@ lp_build_broadcast_scalar(struct lp_build_context *bld,
}
else {
   LLVMValueRef res;
+
+#if HAVE_LLVM = 0x207
   /* The shuffle vector is always made of int32 elements */
   struct lp_type i32_vec_type = lp_type_int_vec(32);
   i32_vec_type.length = type.length;
 
-#if HAVE_LLVM = 0x207
   res = LLVMBuildInsertElement(bld-builder, bld-undef, scalar,
LLVMConstInt(LLVMInt32Type(), 0, 0), );
   res = LLVMBuildShuffleVector(bld-builder, res, bld-undef,

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


Mesa (master): gallivm: make lp_build_sample_nop public

2010-09-16 Thread Keith Whitwell
Module: Mesa
Branch: master
Commit: 045ee4601179c44f815ce3842ef900b36d54c914
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=045ee4601179c44f815ce3842ef900b36d54c914

Author: Keith Whitwell kei...@vmware.com
Date:   Thu Sep 16 12:31:42 2010 +0100

gallivm: make lp_build_sample_nop public

---

 src/gallium/auxiliary/gallivm/lp_bld_sample.h |3 +++
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |   11 +--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h 
b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index ff72b8e..1a9cc94 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -346,6 +346,9 @@ lp_build_sample_soa(LLVMBuilderRef builder,
 LLVMValueRef explicit_lod,
 LLVMValueRef texel_out[4]);
 
+void
+lp_build_sample_nop(struct lp_type type,
+LLVMValueRef texel_out[4]);
 
 
 #endif /* LP_BLD_SAMPLE_H */
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index db6865b..69753d0 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1095,16 +1095,15 @@ lp_build_sample_compare(struct lp_build_sample_context 
*bld,
  * Just set texels to white instead of actually sampling the texture.
  * For debugging.
  */
-static void
-lp_build_sample_nop(struct lp_build_sample_context *bld,
+void
+lp_build_sample_nop(struct lp_type type,
 LLVMValueRef texel_out[4])
 {
-   struct lp_build_context *texel_bld = bld-texel_bld;
+   LLVMValueRef one = lp_build_one(type);
unsigned chan;
 
for (chan = 0; chan  4; chan++) {
-  /*lp_bld_mov(texel_bld, texel, texel_bld-one);*/
-  texel_out[chan] = texel_bld-one;
+  texel_out[chan] = one;
}  
 }
 
@@ -1189,7 +1188,7 @@ lp_build_sample_soa(LLVMBuilderRef builder,
 
if (0) {
   /* For debug: no-op texture sampling */
-  lp_build_sample_nop(bld, texel_out);
+  lp_build_sample_nop(bld.texel_type, texel_out);
}
else if (util_format_fits_8unorm(bld.format_desc) 
 lp_is_simple_wrap_mode(static_state-wrap_s) 

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


Mesa (master): llvmpipe: add LP_PERF flag to disable various aspects of rasterization

2010-09-16 Thread Keith Whitwell
Module: Mesa
Branch: master
Commit: 5f00819cb382bdb70c29e2db3c6ff22a879bf10f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f00819cb382bdb70c29e2db3c6ff22a879bf10f

Author: Keith Whitwell kei...@vmware.com
Date:   Thu Sep 16 10:45:52 2010 +0100

llvmpipe: add LP_PERF flag to disable various aspects of rasterization

Allows disabling various operations (mainly texture-related, but
will grow) to try  identify bottlenecks.

Unlike LP_DEBUG, this is active even in release builds - which is
necessary for performance investigation.

---

 src/gallium/drivers/llvmpipe/lp_clear.c |4 +++
 src/gallium/drivers/llvmpipe/lp_debug.h |   13 ++
 src/gallium/drivers/llvmpipe/lp_screen.c|   15 
 src/gallium/drivers/llvmpipe/lp_setup.c |7 +++--
 src/gallium/drivers/llvmpipe/lp_state_blend.c   |   29 +-
 src/gallium/drivers/llvmpipe/lp_state_sampler.c |   18 +-
 src/gallium/drivers/llvmpipe/lp_state_surface.c |4 +++
 src/gallium/drivers/llvmpipe/lp_tex_sample.c|6 
 8 files changed, 90 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_clear.c 
b/src/gallium/drivers/llvmpipe/lp_clear.c
index 3e8c410..b486b24 100644
--- a/src/gallium/drivers/llvmpipe/lp_clear.c
+++ b/src/gallium/drivers/llvmpipe/lp_clear.c
@@ -36,6 +36,7 @@
 #include lp_clear.h
 #include lp_context.h
 #include lp_setup.h
+#include lp_debug.h
 
 
 /**
@@ -54,5 +55,8 @@ llvmpipe_clear(struct pipe_context *pipe,
if (llvmpipe-no_rast)
   return;
 
+   if (LP_PERF  PERF_NO_DEPTH)
+  buffers = ~PIPE_CLEAR_DEPTHSTENCIL;
+
lp_setup_clear( llvmpipe-setup, rgba, depth, stencil, buffers );
 }
diff --git a/src/gallium/drivers/llvmpipe/lp_debug.h 
b/src/gallium/drivers/llvmpipe/lp_debug.h
index add43e4..588cda5 100644
--- a/src/gallium/drivers/llvmpipe/lp_debug.h
+++ b/src/gallium/drivers/llvmpipe/lp_debug.h
@@ -50,6 +50,19 @@ st_print_current(void);
 #define DEBUG_FENCE 0x2000
 #define DEBUG_MEM   0x4000
 
+/* Performance flags.  These are active even on release builds.
+ */
+#define PERF_TEX_MEM0x1/* minimize texture cache footprint */
+#define PERF_NO_MIP_LINEAR  0x2/* MIP_FILTER_LINEAR == _NEAREST */
+#define PERF_NO_MIPMAPS 0x4/* MIP_FILTER_NONE always */
+#define PERF_NO_LINEAR  0x8/* FILTER_NEAREST always */
+#define PERF_NO_TEX 0x10   /* sample white always */
+#define PERF_NO_BLEND   0x20   /* disable blending */
+#define PERF_NO_DEPTH   0x40   /* disable depth buffering entirely */
+#define PERF_NO_ALPHATEST   0x80   /* disable alpha testing */
+
+
+extern int LP_PERF;
 
 #ifdef DEBUG
 extern int LP_DEBUG;
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c
index 0d40dc5..f920607 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -68,6 +68,19 @@ static const struct debug_named_value lp_debug_flags[] = {
 };
 #endif
 
+int LP_PERF = 0;
+static const struct debug_named_value lp_perf_flags[] = {
+   { texmem, PERF_TEX_MEM, NULL },
+   { no_mipmap,  PERF_NO_MIPMAPS, NULL },
+   { no_linear,  PERF_NO_LINEAR, NULL },
+   { no_mip_linear,  PERF_NO_MIP_LINEAR, NULL },
+   { no_tex, PERF_NO_TEX, NULL },
+   { no_blend,   PERF_NO_BLEND, NULL },
+   { no_depth,   PERF_NO_DEPTH, NULL },
+   { no_alphatest,   PERF_NO_ALPHATEST, NULL },
+   DEBUG_NAMED_VALUE_END
+};
+
 
 static const char *
 llvmpipe_get_vendor(struct pipe_screen *screen)
@@ -372,6 +385,8 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
LP_DEBUG = debug_get_flags_option(LP_DEBUG, lp_debug_flags, 0 );
 #endif
 
+   LP_PERF = debug_get_flags_option(LP_PERF, lp_perf_flags, 0 );
+
if (!screen)
   return NULL;
 
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c 
b/src/gallium/drivers/llvmpipe/lp_setup.c
index e6a8196..6674d28 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -651,11 +651,12 @@ lp_setup_set_fragment_sampler_views(struct 
lp_setup_context *setup,
jit_tex-row_stride[j] = lp_tex-row_stride[j];
jit_tex-img_stride[j] = lp_tex-img_stride[j];
 
-   if (!jit_tex-data[j]) {
+   if ((LP_PERF  PERF_TEX_MEM) ||
+  !jit_tex-data[j]) {
   /* out of memory - use dummy tile memory */
   jit_tex-data[j] = lp_dummy_tile;
-  jit_tex-width = TILE_SIZE;
-  jit_tex-height = TILE_SIZE;
+  jit_tex-width = TILE_SIZE/8;
+  jit_tex-height = TILE_SIZE/8;
   jit_tex-depth = 1;
   jit_tex-last_level = 0;
   jit_tex-row_stride[j] = 0;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_blend.c 
b/src/gallium/drivers/llvmpipe/lp_state_blend.c
index 5b39d9d..6bba907 

Mesa (master): llvmpipe: add DEBUG_FS to dump variant information

2010-09-16 Thread Keith Whitwell
Module: Mesa
Branch: master
Commit: 09863554259aeb7b0522b130837b6a1f12ffaebe
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=09863554259aeb7b0522b130837b6a1f12ffaebe

Author: Keith Whitwell kei...@vmware.com
Date:   Thu Sep 16 15:16:27 2010 +0100

llvmpipe: add DEBUG_FS to dump variant information

---

 src/gallium/drivers/llvmpipe/lp_debug.h|1 +
 src/gallium/drivers/llvmpipe/lp_screen.c   |1 +
 src/gallium/drivers/llvmpipe/lp_state_fs.c |2 +-
 3 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_debug.h 
b/src/gallium/drivers/llvmpipe/lp_debug.h
index 588cda5..15dca52 100644
--- a/src/gallium/drivers/llvmpipe/lp_debug.h
+++ b/src/gallium/drivers/llvmpipe/lp_debug.h
@@ -49,6 +49,7 @@ st_print_current(void);
 #define DEBUG_SCENE 0x1000
 #define DEBUG_FENCE 0x2000
 #define DEBUG_MEM   0x4000
+#define DEBUG_FS0x8000
 
 /* Performance flags.  These are active even on release builds.
  */
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c
index f920607..c66313f 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -64,6 +64,7 @@ static const struct debug_named_value lp_debug_flags[] = {
{ scene, DEBUG_SCENE, NULL },
{ fence, DEBUG_FENCE, NULL },
{ mem, DEBUG_MEM, NULL },
+   { fs, DEBUG_FS, NULL },
DEBUG_NAMED_VALUE_END
 };
 #endif
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 8101e2d..e54dd9f 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -865,7 +865,7 @@ generate_variant(struct llvmpipe_context *lp,
  ? TRUE : FALSE;
 
 
-   if (gallivm_debug  GALLIVM_DEBUG_IR) {
+   if ((LP_DEBUG  DEBUG_FS) || (gallivm_debug  GALLIVM_DEBUG_IR)) {
   lp_debug_fs_variant(variant);
}
 

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


Mesa (master): dri/nv04: Don't expose ARB_texture_env_combine/dot3.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: a27bfb991c7fa8995be4814425c0ad4992447a4b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a27bfb991c7fa8995be4814425c0ad4992447a4b

Author: Andrew Randrianasulu randrianas...@gmail.com
Date:   Tue Sep 14 20:59:44 2010 +0200

dri/nv04: Don't expose ARB_texture_env_combine/dot3.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |2 --
 src/mesa/drivers/dri/nouveau/nv10_context.c|2 ++
 src/mesa/drivers/dri/nouveau/nv20_context.c|2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 4a1534b..1e406a4 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -50,8 +50,6 @@
 static const struct dri_extension nouveau_extensions[] = {
{ GL_ARB_multitexture,NULL },
{ GL_ARB_texture_env_add, NULL },
-   { GL_ARB_texture_env_combine, NULL },
-   { GL_ARB_texture_env_dot3,NULL },
{ GL_ARB_texture_mirrored_repeat, NULL },
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
{ GL_EXT_framebuffer_blit,NULL },
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index b6d1036..7f2 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -34,6 +34,8 @@
 
 static const struct dri_extension nv10_extensions[] = {
{ GL_EXT_texture_rectangle,   NULL },
+   { GL_ARB_texture_env_combine, NULL },
+   { GL_ARB_texture_env_dot3,NULL },
{ NULL, NULL }
 };
 
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c 
b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 789dcaa..03cb14a 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -33,6 +33,8 @@
 
 static const struct dri_extension nv20_extensions[] = {
{ GL_EXT_texture_rectangle,   NULL },
+   { GL_ARB_texture_env_combine, NULL },
+   { GL_ARB_texture_env_dot3,NULL },
{ NULL, NULL }
 };
 

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


Mesa (master): dri/nv04: Enable eng3dm for A8/L8 textures.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: c344f27539a93e885ddcb8ceb066d481a6cd60cf
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c344f27539a93e885ddcb8ceb066d481a6cd60cf

Author: Andrew Randrianasulu randrianas...@gmail.com
Date:   Tue Sep 14 04:29:52 2010 +0200

dri/nv04: Enable eng3dm for A8/L8 textures.

Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nv04_context.c |   20 
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 1d34c86..9c32b48 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -31,6 +31,20 @@
 #include nouveau_class.h
 #include nv04_driver.h
 
+static GLboolean
+texunit_needs_combiners(struct gl_texture_unit *u)
+{
+   struct gl_texture_object *t = u-_Current;
+   struct gl_texture_image *ti = t-Image[0][t-BaseLevel];
+
+   return ti-TexFormat == MESA_FORMAT_A8 ||
+   ti-TexFormat == MESA_FORMAT_L8 ||
+   u-EnvMode == GL_COMBINE ||
+   u-EnvMode == GL_COMBINE4_NV ||
+   u-EnvMode == GL_BLEND ||
+   u-EnvMode == GL_ADD;
+}
+
 struct nouveau_grobj *
 nv04_context_engine(GLcontext *ctx)
 {
@@ -38,10 +52,8 @@ nv04_context_engine(GLcontext *ctx)
struct nouveau_hw_state *hw = to_nouveau_context(ctx)-hw;
struct nouveau_grobj *fahrenheit;
 
-   if (ctx-Texture.Unit[0].EnvMode == GL_COMBINE ||
-   ctx-Texture.Unit[0].EnvMode == GL_COMBINE4_NV ||
-   ctx-Texture.Unit[0].EnvMode == GL_BLEND ||
-   ctx-Texture.Unit[0].EnvMode == GL_ADD ||
+   if ((ctx-Texture.Unit[0]._ReallyEnabled 
+texunit_needs_combiners(ctx-Texture.Unit[0])) ||
ctx-Texture.Unit[1]._ReallyEnabled ||
ctx-Stencil.Enabled)
fahrenheit = hw-eng3dm;

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


Mesa (master): dri/nv04: Fix PGRAPH_ERRORs when running OA.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: aa317a40ced575024924ef5697fc0b96c76e3d90
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa317a40ced575024924ef5697fc0b96c76e3d90

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 00:38:58 2010 +0200

dri/nv04: Fix PGRAPH_ERRORs when running OA.

---

 src/mesa/drivers/dri/nouveau/nv04_state_fb.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
index 5e5e0c5..b9d232d 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
@@ -110,7 +110,11 @@ nv04_emit_scissor(GLcontext *ctx, int emit)
OUT_RING(chan, w  16 | x);
OUT_RING(chan, h  16 | y);
 
-   /* Messing with surf3d invalidates some engine state. */
+   /* Messing with surf3d invalidates the engine state. */
+   context_dirty_i(ctx, TEX_ENV, 0);
+   context_dirty_i(ctx, TEX_ENV, 1);
+   context_dirty_i(ctx, TEX_OBJ, 0);
+   context_dirty_i(ctx, TEX_OBJ, 1);
context_dirty(ctx, CONTROL);
context_dirty(ctx, BLEND);
 }

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


Mesa (master): dri/nv04: Mipmapping fixes.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: bec626ff63ad1d5c7c3e4b5b1d7a741e4f7d55ac
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bec626ff63ad1d5c7c3e4b5b1d7a741e4f7d55ac

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 01:56:04 2010 +0200

dri/nv04: Mipmapping fixes.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   28 ++-
 src/mesa/drivers/dri/nouveau/nv04_state_tex.c  |8 +++---
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 442f4e8..d86f78b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -178,15 +178,21 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
 }
 
 static GLboolean
-teximage_fits(struct gl_texture_object *t, int level)
+teximage_fits(GLcontext *ctx, struct gl_texture_object *t, int level)
 {
struct nouveau_surface *s = to_nouveau_texture(t)-surfaces[level];
struct gl_texture_image *ti = t-Image[0][level];
 
-   return ti  to_nouveau_teximage(ti)-surface.bo 
-   (t-Target == GL_TEXTURE_RECTANGLE ||
-(s-bo  s-format == ti-TexFormat 
- s-width == ti-Width  s-height == ti-Height));
+   if (!ti || !to_nouveau_teximage(ti)-surface.bo)
+   return GL_FALSE;
+
+   if (context_chipset(ctx)  0x10 
+   level == t-BaseLevel  (s-offset  0x7f))
+   return GL_FALSE;
+
+   return t-Target == GL_TEXTURE_RECTANGLE ||
+   (s-bo  s-format == ti-TexFormat 
+s-width == ti-Width  s-height == ti-Height);
 }
 
 static GLboolean
@@ -196,7 +202,7 @@ validate_teximage(GLcontext *ctx, struct gl_texture_object 
*t,
 {
struct gl_texture_image *ti = t-Image[0][level];
 
-   if (teximage_fits(t, level)) {
+   if (teximage_fits(ctx, t, level)) {
struct nouveau_surface *ss = to_nouveau_texture(t)-surfaces;
struct nouveau_surface *s = to_nouveau_teximage(ti)-surface;
 
@@ -284,8 +290,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
struct nouveau_texture *nt = to_nouveau_texture(t);
int i, last = get_last_level(t);
 
-   if (!teximage_fits(t, t-BaseLevel) ||
-   !teximage_fits(t, last))
+   if (!teximage_fits(ctx, t, t-BaseLevel) ||
+   !teximage_fits(ctx, t, last))
return GL_FALSE;
 
if (nt-dirty) {
@@ -308,8 +314,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
 void
 nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t)
 {
-   if (!teximage_fits(t, t-BaseLevel) ||
-   !teximage_fits(t, get_last_level(t))) {
+   if (!teximage_fits(ctx, t, t-BaseLevel) ||
+   !teximage_fits(ctx, t, get_last_level(t))) {
texture_dirty(t);
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);
@@ -371,7 +377,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, 
GLint level,
}
 
if (level == t-BaseLevel) {
-   if (!teximage_fits(t, level))
+   if (!teximage_fits(ctx, t, level))
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);
}
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
index 6d8762b..4ac8327 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
@@ -103,7 +103,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
0, 15) + 1;
 
lod_bias = CLAMP(ctx-Texture.Unit[i].LodBias +
-t-LodBias, 0, 15);
+t-LodBias, -16, 15) * 8;
}
 
format |= get_wrap_mode(t-WrapT)  28 |
@@ -117,7 +117,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
nvgl_filter_mode(t-MagFilter)  28 |
log2i(t-MaxAnisotropy)  27 |
nvgl_filter_mode(t-MinFilter)  24 |
-   lod_bias  16;
+   (lod_bias  0xff)  16;
 
} else {
s = to_nv04_context(ctx)-dummy_texture;
@@ -134,7 +134,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
if (nv04_mtex_engine(fahrenheit)) {
nouveau_bo_markl(bctx, fahrenheit,
 NV04_MULTITEX_TRIANGLE_OFFSET(i),
-s-bo, 0, bo_flags);
+s-bo, s-offset, bo_flags);
 
nouveau_bo_mark(bctx, fahrenheit,
NV04_MULTITEX_TRIANGLE_FORMAT(i),
@@ -149,7 +149,7 @@ nv04_emit_tex_obj(GLcontext *ctx, int emit)
} else {

Mesa (master): dri/nv04: Align SIFM transfer dimensions.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 0a6cfa1668af7c5541c9d56436776514a6c493d9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a6cfa1668af7c5541c9d56436776514a6c493d9

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 06:09:21 2010 +0200

dri/nv04: Align SIFM transfer dimensions.

---

 src/mesa/drivers/dri/nouveau/nv04_surface.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_surface.c 
b/src/mesa/drivers/dri/nouveau/nv04_surface.c
index e3febf7..9e7dcf0 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_surface.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_surface.c
@@ -255,7 +255,7 @@ nv04_surface_copy_swizzle(GLcontext *ctx,
 
BEGIN_RING(chan, sifm,
   NV03_SCALED_IMAGE_FROM_MEMORY_SIZE, 4);
-   OUT_RING(chan, sub_h  16 | sub_w);
+   OUT_RING(chan, align(sub_h, 2)  16 | align(sub_w, 2));
OUT_RING(chan, src-pitch  |
 
NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER |
 
NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE);

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


Mesa (master): dri/nv04: Fix up color mask.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 7b06fdbd3319aae394e66f3a87de9561295bb049
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b06fdbd3319aae394e66f3a87de9561295bb049

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep 16 17:15:05 2010 +0200

dri/nv04: Fix up color mask.

---

 src/mesa/drivers/dri/nouveau/nv04_context.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 9c32b48..1003afb 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -55,7 +55,11 @@ nv04_context_engine(GLcontext *ctx)
if ((ctx-Texture.Unit[0]._ReallyEnabled 
 texunit_needs_combiners(ctx-Texture.Unit[0])) ||
ctx-Texture.Unit[1]._ReallyEnabled ||
-   ctx-Stencil.Enabled)
+   ctx-Stencil.Enabled ||
+   !(ctx-Color.ColorMask[0][RCOMP] 
+ ctx-Color.ColorMask[0][GCOMP] 
+ ctx-Color.ColorMask[0][BCOMP] 
+ ctx-Color.ColorMask[0][ACOMP]))
fahrenheit = hw-eng3dm;
else
fahrenheit = hw-eng3d;

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


Mesa (master): dri/nv04: Fix provoking vertex.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 8f1051dca2d2ea4a4d38f251a5f98fc2a9d097c9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f1051dca2d2ea4a4d38f251a5f98fc2a9d097c9

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep 16 17:16:19 2010 +0200

dri/nv04: Fix provoking vertex.

---

 src/mesa/drivers/dri/nouveau/nv04_render.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_render.c 
b/src/mesa/drivers/dri/nouveau/nv04_render.c
index b5943d9..56e396d 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_render.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_render.c
@@ -162,7 +162,7 @@ swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint 
v3)
OUT_VERTEX(v1);
OUT_VERTEX(v2);
OUT_VERTEX(v3);
-   END_PRIMITIVE(0x210);
+   END_PRIMITIVE(0x102);
 }
 
 static void
@@ -173,7 +173,7 @@ swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, 
GLuint v4)
OUT_VERTEX(v2);
OUT_VERTEX(v3);
OUT_VERTEX(v4);
-   END_PRIMITIVE(0x320210);
+   END_PRIMITIVE(0x213103);
 }
 
 /* TnL initialization. */

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


Mesa (master): dri/nv04: Fix maximum texture size.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 286d8f2877f75d9ad82c55d1fa494f46a4a8f422
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=286d8f2877f75d9ad82c55d1fa494f46a4a8f422

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep 16 17:15:38 2010 +0200

dri/nv04: Fix maximum texture size.

---

 src/mesa/drivers/dri/nouveau/nv04_context.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 1003afb..78703b0 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -188,6 +188,7 @@ nv04_context_create(struct nouveau_screen *screen, const 
GLvisual *visual,
hw-chan-flush_notify = nv04_channel_flush_notify;
 
/* GL constants. */
+   ctx-Const.MaxTextureLevels = 11;
ctx-Const.MaxTextureCoordUnits = NV04_TEXTURE_UNITS;
ctx-Const.MaxTextureImageUnits = NV04_TEXTURE_UNITS;
ctx-Const.MaxTextureUnits = NV04_TEXTURE_UNITS;

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


Mesa (master): dri/nouveau: Update nouveau_class.h.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: aad06c852491d9a83e74625220923da1626896ed
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aad06c852491d9a83e74625220923da1626896ed

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Sep 14 21:22:45 2010 +0200

dri/nouveau: Update nouveau_class.h.

---

 src/mesa/drivers/dri/nouveau/nouveau_class.h |   40 +-
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_class.h 
b/src/mesa/drivers/dri/nouveau/nouveau_class.h
index 32ee815..5cb13ac 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_class.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_class.h
@@ -2340,12 +2340,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define   NV10TCL_RC_OUT_ALPHA_BIAS
(1  15)
 #defineNV10TCL_RC_OUT_ALPHA_BIAS_NONE  
0x
 #defineNV10TCL_RC_OUT_ALPHA_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 
0x8000
-#define   NV10TCL_RC_OUT_ALPHA_SCALE_SHIFT 
17
-#define   NV10TCL_RC_OUT_ALPHA_SCALE_MASK  
0x
+#define   NV10TCL_RC_OUT_ALPHA_SCALE_SHIFT 
16
+#define   NV10TCL_RC_OUT_ALPHA_SCALE_MASK  
0x0003
 #defineNV10TCL_RC_OUT_ALPHA_SCALE_NONE 
0x
-#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_TWO 
0x0002
-#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_FOUR
0x0004
-#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_ONE_HALF
0x0006
+#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_TWO 
0x0001
+#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_FOUR
0x0002
+#defineNV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_ONE_HALF
0x0003
 #define  NV10TCL_RC_OUT_RGB(x) 
(0x0280+((x)*4))
 #define  NV10TCL_RC_OUT_RGB__SIZE  
0x0002
 #define   NV10TCL_RC_OUT_RGB_CD_OUTPUT_SHIFT   
0
@@ -2402,12 +2402,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define   NV10TCL_RC_OUT_RGB_BIAS  
(1  15)
 #defineNV10TCL_RC_OUT_RGB_BIAS_NONE
0x
 #defineNV10TCL_RC_OUT_RGB_BIAS_BIAS_BY_NEGATIVE_ONE_HALF   
0x8000
-#define   NV10TCL_RC_OUT_RGB_SCALE_SHIFT   
17
-#define   NV10TCL_RC_OUT_RGB_SCALE_MASK
0x
+#define   NV10TCL_RC_OUT_RGB_SCALE_SHIFT   
16
+#define   NV10TCL_RC_OUT_RGB_SCALE_MASK
0x0003
 #defineNV10TCL_RC_OUT_RGB_SCALE_NONE   
0x
-#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_TWO   
0x0002
-#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_FOUR  
0x0004
-#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_ONE_HALF  
0x0006
+#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_TWO   
0x0001
+#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_FOUR  
0x0002
+#defineNV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_ONE_HALF  
0x0003
 #define   NV10TCL_RC_OUT_RGB_OPERATION_SHIFT   
27
 #define   NV10TCL_RC_OUT_RGB_OPERATION_MASK
0x3800
 #define  NV10TCL_RC_FINAL0 
0x0288
@@ -4148,12 +4148,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define   NV20TCL_RC_OUT_ALPHA_BIAS
(1  15)
 #defineNV20TCL_RC_OUT_ALPHA_BIAS_NONE  
0x
 #defineNV20TCL_RC_OUT_ALPHA_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 
0x8000
-#define   NV20TCL_RC_OUT_ALPHA_SCALE_SHIFT 
17
-#define   NV20TCL_RC_OUT_ALPHA_SCALE_MASK  
0x
+#define   NV20TCL_RC_OUT_ALPHA_SCALE_SHIFT 
16
+#define   NV20TCL_RC_OUT_ALPHA_SCALE_MASK 

Mesa (master): dri/nouveau: Add some more extensions.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: cbe0dd0f5a5468f821fe39b855e83ae19f28aa7f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cbe0dd0f5a5468f821fe39b855e83ae19f28aa7f

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep 16 17:19:08 2010 +0200

dri/nouveau: Add some more extensions.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |2 ++
 src/mesa/drivers/dri/nouveau/nv10_context.c|1 +
 src/mesa/drivers/dri/nouveau/nv20_context.c|1 +
 3 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 1e406a4..c7e5789 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -54,9 +54,11 @@ static const struct dri_extension nouveau_extensions[] = {
{ GL_EXT_fog_coord,   GL_EXT_fog_coord_functions },
{ GL_EXT_framebuffer_blit,NULL },
{ GL_EXT_framebuffer_object,  GL_EXT_framebuffer_object_functions },
+   { GL_EXT_packed_depth_stencil, NULL},
{ GL_EXT_secondary_color, GL_EXT_secondary_color_functions },
{ GL_EXT_stencil_wrap,NULL },
{ GL_EXT_texture_env_combine, NULL },
+   { GL_EXT_texture_filter_anisotropic, NULL },
{ GL_EXT_texture_lod_bias,NULL },
{ GL_NV_blend_square, NULL },
{ GL_NV_texture_env_combine4, NULL },
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 7f2..08be2a2 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -33,6 +33,7 @@
 #include nv10_driver.h
 
 static const struct dri_extension nv10_extensions[] = {
+   { GL_ARB_texture_env_crossbar, NULL },
{ GL_EXT_texture_rectangle,   NULL },
{ GL_ARB_texture_env_combine, NULL },
{ GL_ARB_texture_env_dot3,NULL },
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c 
b/src/mesa/drivers/dri/nouveau/nv20_context.c
index 03cb14a..b9c221e 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -32,6 +32,7 @@
 #include nv20_driver.h
 
 static const struct dri_extension nv20_extensions[] = {
+   { GL_ARB_texture_env_crossbar, NULL },
{ GL_EXT_texture_rectangle,   NULL },
{ GL_ARB_texture_env_combine, NULL },
{ GL_ARB_texture_env_dot3,NULL },

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


Mesa (master): dri/nouveau: Fix glRenderbufferStorage with DEPTH_COMPONENT as internal format.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 39658f32eaf1acc9603a9a5a2242fba8fd49e08f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=39658f32eaf1acc9603a9a5a2242fba8fd49e08f

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 06:05:53 2010 +0200

dri/nouveau: Fix glRenderbufferStorage with DEPTH_COMPONENT as internal format.

---

 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 32d8f2d..a02a052 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -67,6 +67,7 @@ set_renderbuffer_format(struct gl_renderbuffer *rb, GLenum 
internalFormat)
rb-DataType = GL_UNSIGNED_SHORT;
s-cpp = 2;
break;
+   case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT24:
case GL_STENCIL_INDEX8_EXT:
case GL_DEPTH24_STENCIL8_EXT:

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


Mesa (master): dri/nouveau: Don't request a fake front unnecessarily.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: bfc7518ab993b006dffaad5f605137e94ff9d7bc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfc7518ab993b006dffaad5f605137e94ff9d7bc

Author: Francisco Jerez curroje...@riseup.net
Date:   Tue Sep 14 21:29:44 2010 +0200

dri/nouveau: Don't request a fake front unnecessarily.

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |   37 ++--
 src/mesa/drivers/dri/nouveau/nouveau_fbo.c |1 +
 src/mesa/drivers/dri/nouveau/nouveau_fbo.h |1 +
 src/mesa/drivers/dri/nouveau/nouveau_screen.c  |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_state.c   |8 +
 5 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index c7e5789..244733e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -183,6 +183,7 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, 
__DRIdrawable *draw)
GLcontext *ctx = dri_ctx-driverPrivate;
__DRIscreen *screen = dri_ctx-driScreenPriv;
struct gl_framebuffer *fb = draw-driverPrivate;
+   struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
unsigned int attachments[10];
__DRIbuffer *buffers = NULL;
int i = 0, count, ret;
@@ -191,7 +192,8 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, 
__DRIdrawable *draw)
return;
draw-lastStamp = *draw-pStamp;
 
-   attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
+   if (nfb-need_front)
+   attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
if (fb-Visual.doubleBufferMode)
attachments[i++] = __DRI_BUFFER_BACK_LEFT;
if (fb-Visual.haveDepthBuffer  fb-Visual.haveStencilBuffer)
@@ -327,6 +329,25 @@ nouveau_fallback(GLcontext *ctx, enum nouveau_fallback 
mode)
FIRE_RING(context_chan(ctx));
 }
 
+static void
+validate_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw,
+int *stamp)
+{
+   struct gl_framebuffer *fb = draw-driverPrivate;
+   struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
+   GLboolean need_front =
+   (fb-_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT ||
+fb-_ColorReadBufferIndex == BUFFER_FRONT_LEFT);
+
+   if (nfb-need_front != need_front) {
+   nfb-need_front = need_front;
+   dri2InvalidateDrawable(draw);
+   }
+
+   if (*draw-pStamp != *stamp)
+   update_framebuffer(dri_ctx, draw, stamp);
+}
+
 void
 nouveau_validate_framebuffer(GLcontext *ctx)
 {
@@ -334,15 +355,13 @@ nouveau_validate_framebuffer(GLcontext *ctx)
__DRIdrawable *dri_draw = dri_ctx-driDrawablePriv;
__DRIdrawable *dri_read = dri_ctx-driReadablePriv;
 
-   if (ctx-DrawBuffer-Name == 0 
-   dri_ctx-dri2.draw_stamp != *dri_draw-pStamp)
-   update_framebuffer(dri_ctx, dri_draw,
-  dri_ctx-dri2.draw_stamp);
+   if (ctx-DrawBuffer-Name == 0)
+   validate_framebuffer(dri_ctx, dri_draw,
+dri_ctx-dri2.draw_stamp);
 
-   if (ctx-ReadBuffer-Name == 0  dri_draw != dri_read 
-   dri_ctx-dri2.read_stamp != *dri_read-pStamp)
-   update_framebuffer(dri_ctx, dri_read,
-  dri_ctx-dri2.read_stamp);
+   if (ctx-ReadBuffer-Name == 0)
+   validate_framebuffer(dri_ctx, dri_read,
+dri_ctx-dri2.read_stamp);
 
if (nouveau_next_dirty_state(ctx) = 0) {
nouveau_state_emit(ctx);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index a02a052..f0caf4c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -189,6 +189,7 @@ nouveau_framebuffer_dri_new(const GLvisual *visual)
return NULL;
 
_mesa_initialize_window_framebuffer(nfb-base, visual);
+   nfb-need_front = !visual-doubleBufferMode;
 
return nfb-base;
 }
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h 
b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h
index 5ae984b..0fe6c08 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.h
@@ -30,6 +30,7 @@
 struct nouveau_framebuffer {
struct gl_framebuffer base;
struct nouveau_bo *lma_bo;
+   GLboolean need_front;
 };
 #define to_nouveau_framebuffer(x) ((struct nouveau_framebuffer *)(x))
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c 
b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index 78987f6..4330c8d 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -156,7 +156,7 @@ nouveau_create_buffer(__DRIscreen *dri_screen,
  const __GLcontextModes 

Mesa (master): dri/nouveau: Don't reemit the BO state in nouveau_state_emit ().

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: d4d81ed02e79ef39ab0e06ebc18e1f5b79e2c92d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4d81ed02e79ef39ab0e06ebc18e1f5b79e2c92d

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 16:44:06 2010 +0200

dri/nouveau: Don't reemit the BO state in nouveau_state_emit().

---

 src/mesa/drivers/dri/nouveau/nouveau_state.c |2 --
 src/mesa/drivers/dri/nouveau/nv04_context.c  |6 +++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index 691e51e..01bcbc4 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -459,8 +459,6 @@ nouveau_state_emit(GLcontext *ctx)
}
 
BITSET_ZERO(nctx-dirty);
-
-   nouveau_bo_state_emit(ctx);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 78703b0..94422f5 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -93,15 +93,15 @@ nv04_channel_flush_notify(struct nouveau_channel *chan)
GLcontext *ctx = nctx-base;
 
if (nctx-fallback  SWRAST) {
-   /* Flushing seems to clobber the engine context. */
+   nouveau_bo_state_emit(ctx);
+
+   /* Reemit the engine state. */
context_emit(ctx, TEX_OBJ0);
context_emit(ctx, TEX_OBJ1);
context_emit(ctx, TEX_ENV0);
context_emit(ctx, TEX_ENV1);
context_emit(ctx, CONTROL);
context_emit(ctx, BLEND);
-
-   nouveau_bo_state_emit(ctx);
}
 }
 

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


Mesa (master): dri/nouveau: Cleanup references to the old FBOs on glMakeCurrent().

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: db94a2a5be8e9a8e4de088771874b14b79438299
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=db94a2a5be8e9a8e4de088771874b14b79438299

Author: Francisco Jerez curroje...@riseup.net
Date:   Wed Sep 15 18:03:59 2010 +0200

dri/nouveau: Cleanup references to the old FBOs on glMakeCurrent().

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c |   24 
 1 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 244733e..eff1016 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -212,7 +212,6 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, 
__DRIdrawable *draw)
for (i = 0; i  count; i++) {
struct gl_renderbuffer *rb;
struct nouveau_surface *s;
-   uint32_t old_handle;
int index;
 
switch (buffers[i].attachment) {
@@ -242,19 +241,10 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, 
__DRIdrawable *draw)
s-pitch = buffers[i].pitch;
s-cpp = buffers[i].cpp;
 
-   /* Don't bother to reopen the bo if it happens to be
-* the same. */
-   if (s-bo) {
-   ret = nouveau_bo_handle_get(s-bo, old_handle);
-   assert(!ret);
-   }
-
-   if (!s-bo || old_handle != buffers[i].name) {
-   nouveau_bo_ref(NULL, s-bo);
-   ret = nouveau_bo_handle_ref(context_dev(ctx),
-   buffers[i].name, s-bo);
-   assert(!ret);
-   }
+   nouveau_bo_ref(NULL, s-bo);
+   ret = nouveau_bo_handle_ref(context_dev(ctx),
+   buffers[i].name, s-bo);
+   assert(!ret);
}
 
_mesa_resize_framebuffer(NULL, fb, draw-w, draw-h);
@@ -293,13 +283,15 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, 
__DRIdrawable *dri_draw,
update_framebuffer(dri_ctx, dri_read,
   dri_ctx-dri2.read_stamp);
 
+   /* Clean up references to the old framebuffer objects. */
+   context_bctx(ctx, FRAMEBUFFER);
+   FIRE_RING(context_chan(ctx));
+
/* Pass it down to mesa. */
_mesa_make_current(ctx, dri_draw-driverPrivate,
   dri_read-driverPrivate);
_mesa_update_state(ctx);
 
-   FIRE_RING(context_chan(ctx));
-
} else {
_mesa_make_current(NULL, NULL, NULL);
}

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


Mesa (master): r300g/swtcl: fix CS overrun

2010-09-16 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: d4b2de13bc652cd134826801ada48d0bb88a8258
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4b2de13bc652cd134826801ada48d0bb88a8258

Author: Marek Olšák mar...@gmail.com
Date:   Thu Sep 16 02:04:37 2010 +0200

r300g/swtcl: fix CS overrun

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

---

 src/gallium/drivers/r300/r300_context.h |1 +
 src/gallium/drivers/r300/r300_render.c  |   35 +++---
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.h 
b/src/gallium/drivers/r300/r300_context.h
index 8eddf72..7f655db 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -457,6 +457,7 @@ struct r300_context {
 size_t draw_vbo_size;
 /* Whether the VBO must not be flushed. */
 boolean draw_vbo_locked;
+boolean draw_first_emitted;
 
 /* Accelerated blit support. */
 struct blitter_context* blitter;
diff --git a/src/gallium/drivers/r300/r300_render.c 
b/src/gallium/drivers/r300/r300_render.c
index 177850d..2f00c87 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -753,6 +753,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
 draw_set_mapped_index_buffer(r300-draw, indices);
 
 r300-draw_vbo_locked = TRUE;
+r300-draw_first_emitted = FALSE;
 draw_vbo(r300-draw, info);
 draw_flush(r300-draw);
 r300-draw_vbo_locked = FALSE;
@@ -907,10 +908,17 @@ static void r300_render_draw_arrays(struct vbuf_render* 
render,
 
 DBG(r300, DBG_DRAW, r300: render_draw_arrays (count: %d)\n, count);
 
-if (!r300_emit_states(r300,
-PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
-NULL, 0, 0))
-return;
+if (r300-draw_first_emitted) {
+if (!r300_prepare_for_rendering(r300,
+PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
+NULL, 6, 0, 0))
+return;
+} else {
+if (!r300_emit_states(r300,
+PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
+NULL, 0, 0))
+return;
+}
 
 /* Uncomment to dump all VBOs rendered through this interface.
  * Slow and noisy!
@@ -937,6 +945,8 @@ static void r300_render_draw_arrays(struct vbuf_render* 
render,
 OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count  16) |
r300render-hwprim);
 END_CS;
+
+r300-draw_first_emitted = TRUE;
 }
 
 static void r300_render_draw_elements(struct vbuf_render* render,
@@ -955,10 +965,17 @@ static void r300_render_draw_elements(struct vbuf_render* 
render,
 CS_LOCALS(r300);
 DBG(r300, DBG_DRAW, r300: render_draw_elements (count: %d)\n, count);
 
-if (!r300_emit_states(r300,
-PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
-NULL, 0, 0))
-return;
+if (r300-draw_first_emitted) {
+if (!r300_prepare_for_rendering(r300,
+PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
+NULL, 256, 0, 0))
+return;
+} else {
+if (!r300_emit_states(r300,
+PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
+NULL, 0, 0))
+return;
+}
 
 /* Below we manage the CS space manually because there may be more
  * indices than it can fit in CS. */
@@ -999,6 +1016,8 @@ static void r300_render_draw_elements(struct vbuf_render* 
render,
 end_cs_dwords = r300_get_num_cs_end_dwords(r300);
 }
 }
+
+r300-draw_first_emitted = TRUE;
 }
 
 static void r300_render_destroy(struct vbuf_render* render)

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


Mesa (7.9): r300g/swtcl: fix CS overrun

2010-09-16 Thread Marek Olšák
Module: Mesa
Branch: 7.9
Commit: be16a35438b01ad54600a82abc3ce2143318b419
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=be16a35438b01ad54600a82abc3ce2143318b419

Author: Marek Olšák mar...@gmail.com
Date:   Thu Sep 16 02:04:37 2010 +0200

r300g/swtcl: fix CS overrun

https://bugs.freedesktop.org/show_bug.cgi?id=29901
(cherry picked from commit d4b2de13bc652cd134826801ada48d0bb88a8258)

---

 src/gallium/drivers/r300/r300_context.h |1 +
 src/gallium/drivers/r300/r300_render.c  |   35 +++---
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.h 
b/src/gallium/drivers/r300/r300_context.h
index 8eddf72..7f655db 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -457,6 +457,7 @@ struct r300_context {
 size_t draw_vbo_size;
 /* Whether the VBO must not be flushed. */
 boolean draw_vbo_locked;
+boolean draw_first_emitted;
 
 /* Accelerated blit support. */
 struct blitter_context* blitter;
diff --git a/src/gallium/drivers/r300/r300_render.c 
b/src/gallium/drivers/r300/r300_render.c
index 177850d..2f00c87 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -753,6 +753,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
 draw_set_mapped_index_buffer(r300-draw, indices);
 
 r300-draw_vbo_locked = TRUE;
+r300-draw_first_emitted = FALSE;
 draw_vbo(r300-draw, info);
 draw_flush(r300-draw);
 r300-draw_vbo_locked = FALSE;
@@ -907,10 +908,17 @@ static void r300_render_draw_arrays(struct vbuf_render* 
render,
 
 DBG(r300, DBG_DRAW, r300: render_draw_arrays (count: %d)\n, count);
 
-if (!r300_emit_states(r300,
-PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
-NULL, 0, 0))
-return;
+if (r300-draw_first_emitted) {
+if (!r300_prepare_for_rendering(r300,
+PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
+NULL, 6, 0, 0))
+return;
+} else {
+if (!r300_emit_states(r300,
+PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
+NULL, 0, 0))
+return;
+}
 
 /* Uncomment to dump all VBOs rendered through this interface.
  * Slow and noisy!
@@ -937,6 +945,8 @@ static void r300_render_draw_arrays(struct vbuf_render* 
render,
 OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count  16) |
r300render-hwprim);
 END_CS;
+
+r300-draw_first_emitted = TRUE;
 }
 
 static void r300_render_draw_elements(struct vbuf_render* render,
@@ -955,10 +965,17 @@ static void r300_render_draw_elements(struct vbuf_render* 
render,
 CS_LOCALS(r300);
 DBG(r300, DBG_DRAW, r300: render_draw_elements (count: %d)\n, count);
 
-if (!r300_emit_states(r300,
-PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
-NULL, 0, 0))
-return;
+if (r300-draw_first_emitted) {
+if (!r300_prepare_for_rendering(r300,
+PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
+NULL, 256, 0, 0))
+return;
+} else {
+if (!r300_emit_states(r300,
+PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
+NULL, 0, 0))
+return;
+}
 
 /* Below we manage the CS space manually because there may be more
  * indices than it can fit in CS. */
@@ -999,6 +1016,8 @@ static void r300_render_draw_elements(struct vbuf_render* 
render,
 end_cs_dwords = r300_get_num_cs_end_dwords(r300);
 }
 }
+
+r300-draw_first_emitted = TRUE;
 }
 
 static void r300_render_destroy(struct vbuf_render* render)

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


Mesa (master): mesa: include mfeatures.h in formats.c

2010-09-16 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 3a6f9d0f47861b1c618366d679ad8ddd9a06b323
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a6f9d0f47861b1c618366d679ad8ddd9a06b323

Author: Brian Paul bri...@vmware.com
Date:   Thu Sep 16 12:40:05 2010 -0600

mesa: include mfeatures.h in formats.c

Otherwise, FEATURE_EXT_texture_sRGB was undefined.
This is (part of?) the fix for fd.o bug 30177.

---

 src/mesa/main/formats.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 112d7a0..9db9f1c 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -26,6 +26,7 @@
 
 #include imports.h
 #include formats.h
+#include mfeatures.h
 
 
 /**

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


Mesa (7.9): mesa: include mfeatures.h in formats.c

2010-09-16 Thread Brian Paul
Module: Mesa
Branch: 7.9
Commit: d169a67ad18b8f57210d991a77c86e012551642c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d169a67ad18b8f57210d991a77c86e012551642c

Author: Brian Paul bri...@vmware.com
Date:   Thu Sep 16 12:42:53 2010 -0600

mesa: include mfeatures.h in formats.c

Otherwise, FEATURE_EXT_texture_sRGB was undefined.
This is (part of?) the fix for fd.o bug 30177.

(cherry picked from commit 3a6f9d0f47861b1c618366d679ad8ddd9a06b323)

---

 src/mesa/main/formats.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 112d7a0..9db9f1c 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -26,6 +26,7 @@
 
 #include imports.h
 #include formats.h
+#include mfeatures.h
 
 
 /**

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


Mesa (master): meta: Don' t bind the created texture object in init_temp_texture().

2010-09-16 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 50ac56bf98d6fd16fd1b7534268ee362e45b691d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=50ac56bf98d6fd16fd1b7534268ee362e45b691d

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Sep 16 10:52:30 2010 -0700

meta: Don't bind the created texture object in init_temp_texture().

This function is executed outside _mesa_meta_begin/end(), that means
that e.g. _mesa_meta_Bitmap() clobbers the texturing state because it
changes the currently active texture object.

There's no need to bind the new texture when it's created, it's done
again later anyway (from setup_drawpix/copypix_texture()).

Signed-off-by: Brian Paul bri...@vmware.com

---

 src/mesa/drivers/common/meta.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index a03cb68..87d116a 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -855,7 +855,6 @@ init_temp_texture(GLcontext *ctx, struct temp_texture *tex)
assert(tex-MaxSize  0);
 
_mesa_GenTextures(1, tex-TexObj);
-   _mesa_BindTexture(tex-Target, tex-TexObj);
 }
 
 

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


Mesa (master): gallivm: Fix address register swizzle.

2010-09-16 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 3d5b9c1f2d3340259dd0d8765090a5a963074f29
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d5b9c1f2d3340259dd0d8765090a5a963074f29

Author: José Fonseca jfons...@vmware.com
Date:   Thu Sep 16 09:52:20 2010 +0100

gallivm: Fix address register swizzle.

We're actually doing a double swizzling:

  indirect_reg-Swizzle[indirect_reg-SwizzleX]

instead of simply

  indirect_reg-SwizzleX

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index cd5b132..0d8d49b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -476,9 +476,8 @@ get_indirect_offsets(struct lp_build_tgsi_soa_context *bld,
  const struct tgsi_src_register *indirect_reg)
 {
/* always use X component of address register */
-   const int x = indirect_reg-SwizzleX;
+   unsigned swizzle = indirect_reg-SwizzleX;
LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld-base.type);
-   uint swizzle = tgsi_util_get_src_register_swizzle(indirect_reg, x);
LLVMValueRef vec4 = lp_build_const_int_vec(bld-int_bld.type, 4); 
LLVMValueRef addr_vec;
 

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


Mesa (master): gallivm: Start collecting bitwise arithmetic helpers in a new module.

2010-09-16 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 795eb3d64a001a65d677e3168bdd056cc5385b7e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=795eb3d64a001a65d677e3168bdd056cc5385b7e

Author: José Fonseca jfons...@vmware.com
Date:   Thu Sep 16 11:44:01 2010 +0100

gallivm: Start collecting bitwise arithmetic helpers in a new module.

---

 src/gallium/auxiliary/Makefile|1 +
 src/gallium/auxiliary/SConscript  |1 +
 src/gallium/auxiliary/gallivm/lp_bld_bitarit.c|  187 +
 src/gallium/auxiliary/gallivm/lp_bld_bitarit.h|   69 
 src/gallium/auxiliary/gallivm/lp_bld_logic.c  |   25 ---
 src/gallium/auxiliary/gallivm/lp_bld_logic.h  |4 -
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |3 +-
 src/gallium/drivers/llvmpipe/lp_bld_depth.c   |5 +-
 8 files changed, 263 insertions(+), 32 deletions(-)

diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index 2a69294..2de764c 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -153,6 +153,7 @@ C_SOURCES = \
 GALLIVM_SOURCES = \
 gallivm/lp_bld_arit.c \
 gallivm/lp_bld_assert.c \
+gallivm/lp_bld_bitarit.c \
 gallivm/lp_bld_const.c \
 gallivm/lp_bld_conv.c \
 gallivm/lp_bld_debug.c \
diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
index cea2d7d..294df30 100644
--- a/src/gallium/auxiliary/SConscript
+++ b/src/gallium/auxiliary/SConscript
@@ -203,6 +203,7 @@ if env['llvm']:
 source += [
 'gallivm/lp_bld_arit.c',
 'gallivm/lp_bld_assert.c',
+'gallivm/lp_bld_bitarit.c',
 'gallivm/lp_bld_const.c',
 'gallivm/lp_bld_conv.c',
 'gallivm/lp_bld_debug.c',
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_bitarit.c 
b/src/gallium/auxiliary/gallivm/lp_bld_bitarit.c
new file mode 100644
index 000..55513c4
--- /dev/null
+++ b/src/gallium/auxiliary/gallivm/lp_bld_bitarit.c
@@ -0,0 +1,187 @@
+/**
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * Software), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS 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.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **/
+
+
+#include util/u_debug.h
+
+#include lp_bld_type.h
+#include lp_bld_debug.h
+#include lp_bld_const.h
+#include lp_bld_bitarit.h
+
+
+/**
+ * Return (a | b)
+ */
+LLVMValueRef
+lp_build_or(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
+{
+   const struct lp_type type = bld-type;
+   LLVMValueRef res;
+
+   assert(lp_check_value(type, a));
+   assert(lp_check_value(type, b));
+
+   /* can't do bitwise ops on floating-point values */
+   if (type.floating) {
+  a = LLVMBuildBitCast(bld-builder, a, bld-int_vec_type, );
+  b = LLVMBuildBitCast(bld-builder, b, bld-int_vec_type, );
+   }
+
+   res = LLVMBuildOr(bld-builder, a, b, );
+
+   if (type.floating) {
+  res = LLVMBuildBitCast(bld-builder, res, bld-vec_type, );
+   }
+
+   return b;
+}
+
+
+/**
+ * Return (a  b)
+ */
+LLVMValueRef
+lp_build_and(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
+{
+   const struct lp_type type = bld-type;
+   LLVMValueRef res;
+
+   assert(lp_check_value(type, a));
+   assert(lp_check_value(type, b));
+
+   /* can't do bitwise ops on floating-point values */
+   if (type.floating) {
+  a = LLVMBuildBitCast(bld-builder, a, bld-int_vec_type, );
+  b = LLVMBuildBitCast(bld-builder, b, bld-int_vec_type, );
+   }
+
+   res = LLVMBuildAnd(bld-builder, a, b, );
+
+   if (type.floating) {
+  res = LLVMBuildBitCast(bld-builder, res, bld-vec_type, );
+   }
+
+   return b;
+}
+
+
+/**
+ * Return (a  ~b)
+ */
+LLVMValueRef
+lp_build_andnot(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
+{
+   const struct lp_type type = bld-type;
+   LLVMValueRef res;
+

Mesa (master): gallivm: Clamp indirect register indices to file_max.

2010-09-16 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 6d173da5c84142ee64f56f4c2e9e495dc1435e91
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d173da5c84142ee64f56f4c2e9e495dc1435e91

Author: José Fonseca jfons...@vmware.com
Date:   Thu Sep 16 11:45:16 2010 +0100

gallivm: Clamp indirect register indices to file_max.

Prevents crashes with bogus data, or bad shader translation.

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |  131 --
 1 files changed, 71 insertions(+), 60 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 0d8d49b..441aeba 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -49,6 +49,7 @@
 #include lp_bld_type.h
 #include lp_bld_const.h
 #include lp_bld_arit.h
+#include lp_bld_bitarit.h
 #include lp_bld_gather.h
 #include lp_bld_logic.h
 #include lp_bld_swizzle.h
@@ -119,7 +120,7 @@ struct lp_build_tgsi_soa_context
struct lp_build_context base;
 
/* Builder for integer masks and indices */
-   struct lp_build_context int_bld;
+   struct lp_build_context uint_bld;
 
LLVMValueRef consts_ptr;
const LLVMValueRef *pos;
@@ -139,6 +140,7 @@ struct lp_build_tgsi_soa_context
 */
LLVMValueRef temps_array;
 
+   const struct tgsi_shader_info *info;
/** bitmask indicating which register files are accessed indirectly */
unsigned indirect_files;
 
@@ -472,27 +474,41 @@ build_gather(struct lp_build_tgsi_soa_context *bld,
  * temporary register file.
  */
 static LLVMValueRef
-get_indirect_offsets(struct lp_build_tgsi_soa_context *bld,
- const struct tgsi_src_register *indirect_reg)
+get_indirect_index(struct lp_build_tgsi_soa_context *bld,
+   unsigned reg_file, unsigned reg_index,
+   const struct tgsi_src_register *indirect_reg)
 {
+   struct lp_build_context *uint_bld = bld-uint_bld;
/* always use X component of address register */
unsigned swizzle = indirect_reg-SwizzleX;
-   LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld-base.type);
-   LLVMValueRef vec4 = lp_build_const_int_vec(bld-int_bld.type, 4); 
-   LLVMValueRef addr_vec;
+   LLVMValueRef base;
+   LLVMValueRef rel;
+   LLVMValueRef max_index;
+   LLVMValueRef index;
 
-   addr_vec = LLVMBuildLoad(bld-base.builder,
-bld-addr[indirect_reg-Index][swizzle],
-load addr reg);
+   assert(bld-indirect_files  (1  reg_file));
+
+   base = lp_build_const_int_vec(uint_bld-type, reg_index);
+
+   assert(swizzle  4);
+   rel = LLVMBuildLoad(bld-base.builder,
+bld-addr[indirect_reg-Index][swizzle],
+load addr reg);
 
/* for indexing we want integers */
-   addr_vec = LLVMBuildFPToSI(bld-base.builder, addr_vec,
-  int_vec_type, );
+   rel = LLVMBuildFPToSI(bld-base.builder,
+ rel,
+ uint_bld-vec_type, );
+
+   index = lp_build_add(uint_bld, base, rel);
 
-   /* addr_vec = addr_vec * 4 */
-   addr_vec = lp_build_mul(bld-int_bld, addr_vec, vec4);
+   max_index = lp_build_const_int_vec(uint_bld-type,
+  bld-info-file_max[reg_file]);
 
-   return addr_vec;
+   assert(!uint_bld-type.sign);
+   index = lp_build_min(uint_bld, index, max_index);
+
+   return index;
 }
 
 
@@ -506,11 +522,12 @@ emit_fetch(
unsigned src_op,
const unsigned chan_index )
 {
+   struct lp_build_context *uint_bld = bld-uint_bld;
const struct tgsi_full_src_register *reg = inst-Src[src_op];
const unsigned swizzle =
   tgsi_util_get_full_src_register_swizzle(reg, chan_index);
LLVMValueRef res;
-   LLVMValueRef addr_vec = NULL;
+   LLVMValueRef indirect_index = NULL;
 
if (swizzle  3) {
   assert(0  invalid swizzle in emit_fetch());
@@ -518,23 +535,24 @@ emit_fetch(
}
 
if (reg-Register.Indirect) {
-  assert(bld-indirect_files);
-  addr_vec = get_indirect_offsets(bld, reg-Indirect);
+  indirect_index = get_indirect_index(bld,
+  reg-Register.File,
+  reg-Register.Index,
+  reg-Indirect);
+   } else {
+  assert(reg-Register.Index = bld-info-file_max[reg-Register.File]);
}
 
switch (reg-Register.File) {
case TGSI_FILE_CONSTANT:
   if (reg-Register.Indirect) {
+ LLVMValueRef swizzle_vec =
+lp_build_const_int_vec(uint_bld-type, swizzle);
  LLVMValueRef index_vec;  /* index into the const buffer */
 
- assert(bld-indirect_files  (1  TGSI_FILE_CONSTANT));
-
- /* index_vec = broadcast(reg-Register.Index * 4 + swizzle) */
- index_vec = lp_build_const_int_vec(bld-int_bld.type,
-reg-Register.Index * 4 + swizzle);
-
- /* index_vec = 

Mesa (master): tgsi/sse: fix aos_to_soa() loop to handle num_inputs==0

2010-09-16 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4b27c614cf4b06ad0c2a0414f60737f19eed021d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b27c614cf4b06ad0c2a0414f60737f19eed021d

Author: Brian Paul bri...@vmware.com
Date:   Thu Sep 16 19:02:42 2010 -0600

tgsi/sse: fix aos_to_soa() loop to handle num_inputs==0

Basically, change the loop from:
  do {...} while (--num_inputs != 0)
into:
  while (num_inputs != 0) { ... --num_inputs; }

Fixes fd.o bug 29987.

---

 src/gallium/auxiliary/tgsi/tgsi_sse2.c |   15 +--
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c 
b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
index 785a9fb..13e2e8e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
@@ -2703,8 +2703,7 @@ static void aos_to_soa( struct x86_function *func,
struct x86_reg aos_input = x86_make_reg( file_REG32, reg_BX );
struct x86_reg num_inputs = x86_make_reg( file_REG32, reg_CX );
struct x86_reg stride = x86_make_reg( file_REG32, reg_DX );
-   int inner_loop;
-
+   int loop_top, loop_exit_fixup;
 
/* Save EBX */
x86_push( func, x86_make_reg( file_REG32, reg_BX ) );
@@ -2717,8 +2716,11 @@ static void aos_to_soa( struct x86_function *func,
x86_mov( func, num_inputs, x86_fn_arg( func, arg_num ) );
x86_mov( func, stride, x86_fn_arg( func, arg_stride ) );
 
-   /* do */
-   inner_loop = x86_get_label( func );
+   /* while (num_inputs != 0) */
+   loop_top = x86_get_label( func );
+   x86_cmp_imm( func, num_inputs, 0 );
+   loop_exit_fixup = x86_jcc_forward( func, cc_E );
+
{
   x86_push( func, aos_input );
   sse_movlps( func, make_xmm( 0 ), x86_make_disp( aos_input, 0 ) );
@@ -2750,9 +2752,10 @@ static void aos_to_soa( struct x86_function *func,
   x86_lea( func, aos_input, x86_make_disp(aos_input, 16) );
   x86_lea( func, soa_input, x86_make_disp(soa_input, 64) );
}
-   /* while --num_inputs */
+   /* --num_inputs */
x86_dec( func, num_inputs );
-   x86_jcc( func, cc_NE, inner_loop );
+   x86_jmp( func, loop_top );
+   x86_fixup_fwd_jump( func, loop_exit_fixup );
 
/* Restore EBX */
x86_pop( func, x86_make_reg( file_REG32, reg_BX ) );

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


Mesa (master): dri/nv10: Fix the CLAMP texture wrap mode.

2010-09-16 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 82c4af33b0d860e27f4c2d3b3d2401c7549de355
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=82c4af33b0d860e27f4c2d3b3d2401c7549de355

Author: Francisco Jerez curroje...@riseup.net
Date:   Fri Sep 17 05:29:48 2010 +0200

dri/nv10: Fix the CLAMP texture wrap mode.

---

 src/mesa/drivers/dri/nouveau/nouveau_gldefs.h |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h 
b/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
index fbeed3b..46ec14e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
@@ -228,12 +228,11 @@ nvgl_wrap_mode(unsigned wrap)
return 0x1;
case GL_MIRRORED_REPEAT:
return 0x2;
+   case GL_CLAMP:
case GL_CLAMP_TO_EDGE:
return 0x3;
case GL_CLAMP_TO_BORDER:
return 0x4;
-   case GL_CLAMP:
-   return 0x5;
default:
assert(0);
}

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


Mesa (master): targets/egl: Use C++ compiler to link GL/ES state trackers.

2010-09-16 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: cadc4ad963b5392c6f6729f01f01e377ea1e8c41
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cadc4ad963b5392c6f6729f01f01e377ea1e8c41

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Sep 16 12:42:53 2010 +0800

targets/egl: Use C++ compiler to link GL/ES state trackers.

Otherwise, applications compiled with C compiler might have trouble
using them.

---

 src/gallium/targets/egl/Makefile |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
index 78f7241..47c24ce 100644
--- a/src/gallium/targets/egl/Makefile
+++ b/src/gallium/targets/egl/Makefile
@@ -185,6 +185,13 @@ $(MKLIB) -o $(notdir $@) -noprefix -linker '$(CC)' 
-ldflags '$(LDFLAGS)' \
$(common_SYS) $($(1)_SYS)
 endef
 
+define mklib-cxx
+$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
+   -cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) $ \
+   -Wl,--start-group $(common_LIBS) $($(1)_LIBS) -Wl,--end-group \
+   $(common_SYS) $($(1)_SYS)
+endef
+
 # EGL driver
 $(OUTPUT_PATH)/egl_gallium.so: egl.o $(egl_LIBS)
$(call mklib,egl)
@@ -213,13 +220,13 @@ $(OUTPUT_PATH)/$(PIPE_PREFIX)swrast.so: pipe_swrast.o 
$(swrast_LIBS)
 
 # state trackers
 $(OUTPUT_PATH)/$(ST_PREFIX)$(GL_LIB).so: st_GL.o $(GL_LIBS)
-   $(call mklib,GL)
+   $(call mklib-cxx,GL)
 
 $(OUTPUT_PATH)/$(ST_PREFIX)$(GLESv1_CM_LIB).so: st_GLESv1_CM.o 
$(GLESv1_CM_LIBS)
-   $(call mklib,GLESv1_CM)
+   $(call mklib-cxx,GLESv1_CM)
 
 $(OUTPUT_PATH)/$(ST_PREFIX)$(GLESv2_LIB).so: st_GLESv2.o $(GLESv2_LIBS)
-   $(call mklib,GLESv2)
+   $(call mklib-cxx,GLESv2)
 
 $(OUTPUT_PATH)/$(ST_PREFIX)$(VG_LIB).so: st_OpenVG.o $(OpenVG_LIBS)
$(call mklib,OpenVG)

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


Mesa (master): libgl-xlib: Remove unused st_api_create_OpenGL.

2010-09-16 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 0dbcf3b014ff05843bc71235652cd4a0e089bbc9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0dbcf3b014ff05843bc71235652cd4a0e089bbc9

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Sep 16 13:29:26 2010 +0800

libgl-xlib: Remove unused st_api_create_OpenGL.

st/egl no longer relies on libGL for OpenGL support.

---

 src/gallium/targets/libgl-xlib/xlib.c |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/src/gallium/targets/libgl-xlib/xlib.c 
b/src/gallium/targets/libgl-xlib/xlib.c
index 5914f63..2f8cd2d 100644
--- a/src/gallium/targets/libgl-xlib/xlib.c
+++ b/src/gallium/targets/libgl-xlib/xlib.c
@@ -39,14 +39,6 @@
 #include state_tracker/st_api.h
 #include state_tracker/st_gl_api.h
 
-/* piggy back on this libGL for OpenGL support in EGL */
-struct st_api *
-st_api_create_OpenGL()
-{
-   return st_gl_api_create();
-}
-
-
 /* Helper function to choose and instantiate one of the software rasterizers:
  * cell, llvmpipe, softpipe.
  *

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


Mesa (7.9): libgl-xlib: Remove unused st_api_create_OpenGL.

2010-09-16 Thread Chia-I Wu
Module: Mesa
Branch: 7.9
Commit: 69f67f5ded6963ca83f8601f218f6dabf8bfbba5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=69f67f5ded6963ca83f8601f218f6dabf8bfbba5

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Sep 16 13:29:26 2010 +0800

libgl-xlib: Remove unused st_api_create_OpenGL.

st/egl no longer relies on libGL for OpenGL support.

---

 src/gallium/targets/libgl-xlib/xlib.c |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/src/gallium/targets/libgl-xlib/xlib.c 
b/src/gallium/targets/libgl-xlib/xlib.c
index 5914f63..2f8cd2d 100644
--- a/src/gallium/targets/libgl-xlib/xlib.c
+++ b/src/gallium/targets/libgl-xlib/xlib.c
@@ -39,14 +39,6 @@
 #include state_tracker/st_api.h
 #include state_tracker/st_gl_api.h
 
-/* piggy back on this libGL for OpenGL support in EGL */
-struct st_api *
-st_api_create_OpenGL()
-{
-   return st_gl_api_create();
-}
-
-
 /* Helper function to choose and instantiate one of the software rasterizers:
  * cell, llvmpipe, softpipe.
  *

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


Mesa (7.9): targets/egl: Use C++ compiler to link GL/ES state trackers.

2010-09-16 Thread Chia-I Wu
Module: Mesa
Branch: 7.9
Commit: a42527be334e04d4f2406e23ed89d20deb9ea9b3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a42527be334e04d4f2406e23ed89d20deb9ea9b3

Author: Chia-I Wu o...@lunarg.com
Date:   Thu Sep 16 12:42:53 2010 +0800

targets/egl: Use C++ compiler to link GL/ES state trackers.

Otherwise, applications compiled with C compiler might have trouble
using them.

---

 src/gallium/targets/egl/Makefile |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
index 78f7241..47c24ce 100644
--- a/src/gallium/targets/egl/Makefile
+++ b/src/gallium/targets/egl/Makefile
@@ -185,6 +185,13 @@ $(MKLIB) -o $(notdir $@) -noprefix -linker '$(CC)' 
-ldflags '$(LDFLAGS)' \
$(common_SYS) $($(1)_SYS)
 endef
 
+define mklib-cxx
+$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
+   -cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) $ \
+   -Wl,--start-group $(common_LIBS) $($(1)_LIBS) -Wl,--end-group \
+   $(common_SYS) $($(1)_SYS)
+endef
+
 # EGL driver
 $(OUTPUT_PATH)/egl_gallium.so: egl.o $(egl_LIBS)
$(call mklib,egl)
@@ -213,13 +220,13 @@ $(OUTPUT_PATH)/$(PIPE_PREFIX)swrast.so: pipe_swrast.o 
$(swrast_LIBS)
 
 # state trackers
 $(OUTPUT_PATH)/$(ST_PREFIX)$(GL_LIB).so: st_GL.o $(GL_LIBS)
-   $(call mklib,GL)
+   $(call mklib-cxx,GL)
 
 $(OUTPUT_PATH)/$(ST_PREFIX)$(GLESv1_CM_LIB).so: st_GLESv1_CM.o 
$(GLESv1_CM_LIBS)
-   $(call mklib,GLESv1_CM)
+   $(call mklib-cxx,GLESv1_CM)
 
 $(OUTPUT_PATH)/$(ST_PREFIX)$(GLESv2_LIB).so: st_GLESv2.o $(GLESv2_LIBS)
-   $(call mklib,GLESv2)
+   $(call mklib-cxx,GLESv2)
 
 $(OUTPUT_PATH)/$(ST_PREFIX)$(VG_LIB).so: st_OpenVG.o $(OpenVG_LIBS)
$(call mklib,OpenVG)

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


Mesa (master): r600g: move constant buffer creation behind winsys abstraction.

2010-09-16 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 7c1fcc41be15b6d648f84c8c1870a3a00575a48f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c1fcc41be15b6d648f84c8c1870a3a00575a48f

Author: Dave Airlie airl...@redhat.com
Date:   Fri Sep 17 12:47:49 2010 +1000

r600g: move constant buffer creation behind winsys abstraction.

this paves the way for moving to pb bufmgrs now.

---

 src/gallium/drivers/r600/r600_blit.c   |   12 
 src/gallium/drivers/r600/r600_buffer.c |   33 ++---
 src/gallium/drivers/r600/r600_query.c  |4 +-
 src/gallium/drivers/r600/r600_resource.h   |1 -
 src/gallium/drivers/r600/r600_screen.c |1 +
 src/gallium/drivers/r600/r600_shader.c |4 +-
 src/gallium/drivers/r600/r600_texture.c|6 ++--
 src/gallium/drivers/r600/radeon.h  |7 +++-
 src/gallium/winsys/r600/drm/radeon.c   |5 +++
 src/gallium/winsys/r600/drm/radeon_ctx.c   |2 +-
 src/gallium/winsys/r600/drm/radeon_priv.h  |2 +
 src/gallium/winsys/r600/drm/radeon_ws_bo.c |   43 ++--
 12 files changed, 65 insertions(+), 55 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_blit.c 
b/src/gallium/drivers/r600/r600_blit.c
index 0e061c2..54fbc50 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -179,11 +179,11 @@ static int r600_blit_state_vs_resources(struct 
r600_screen *rscreen, struct r600
};
 
/* simple shader */
-   bo = radeon_ws_bo(rscreen-rw, 128, 4096);
+   bo = radeon_ws_bo(rscreen-rw, 128, 4096, 0);
if (bo == NULL) {
return -ENOMEM;
}
-   data = radeon_ws_bo_map(rscreen-rw, bo);
+   data = radeon_ws_bo_map(rscreen-rw, bo, 0, NULL);
if (!data) {
radeon_ws_bo_reference(rscreen-rw, bo, NULL);
return -ENOMEM;
@@ -274,11 +274,11 @@ static void r600_blit_state_vs_shader(struct r600_screen 
*rscreen, struct radeon
};
 
/* simple shader */
-   bo = radeon_ws_bo(rscreen-rw, 128, 4096);
+   bo = radeon_ws_bo(rscreen-rw, 128, 4096, 0);
if (bo == NULL) {
return;
}
-   data = radeon_ws_bo_map(rscreen-rw, bo);
+   data = radeon_ws_bo_map(rscreen-rw, bo, 0, NULL);
if (!data) {
radeon_ws_bo_reference(rscreen-rw, bo, NULL);
return;
@@ -338,11 +338,11 @@ static void r600_blit_state_ps_shader(struct r600_screen 
*rscreen, struct radeon
};
 
/* simple shader */
-   bo = radeon_ws_bo(rscreen-rw, 128, 4096);
+   bo = radeon_ws_bo(rscreen-rw, 128, 4096, 0);
if (bo == NULL) {
return;
}
-   data = radeon_ws_bo_map(rscreen-rw, bo);
+   data = radeon_ws_bo_map(rscreen-rw, bo, 0, NULL);
if (!data) {
radeon_ws_bo_reference(rscreen-rw, bo, NULL);
return;
diff --git a/src/gallium/drivers/r600/r600_buffer.c 
b/src/gallium/drivers/r600/r600_buffer.c
index 37abf42..a38c013 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -69,7 +69,6 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen 
*screen,
struct r600_screen *rscreen = r600_screen(screen);
struct r600_resource *rbuffer;
struct radeon_ws_bo *bo;
-   struct pb_desc desc;
/* XXX We probably want a different alignment for buffers and textures. 
*/
unsigned alignment = 4096;
 
@@ -82,19 +81,8 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen 
*screen,
rbuffer-base.b.screen = screen;
rbuffer-base.vtbl = r600_buffer_vtbl;
rbuffer-size = rbuffer-base.b.width0;
-   if ((rscreen-use_mem_constant == FALSE)  (rbuffer-base.b.bind  
PIPE_BIND_CONSTANT_BUFFER)) {
-   desc.alignment = alignment;
-   desc.usage = rbuffer-base.b.bind;
-   rbuffer-pb = pb_malloc_buffer_create(rbuffer-base.b.width0,
- desc);
-   if (rbuffer-pb == NULL) {
-   free(rbuffer);
-   return NULL;
-   }
-   return rbuffer-base.b;
-   }
rbuffer-domain = r600_domain_from_usage(rbuffer-base.b.bind);
-   bo = radeon_ws_bo(rscreen-rw, rbuffer-base.b.width0, alignment);
+   bo = radeon_ws_bo(rscreen-rw, rbuffer-base.b.width0, alignment, 
rbuffer-base.b.bind);
if (bo == NULL) {
FREE(rbuffer);
return NULL;
@@ -125,7 +113,7 @@ struct pipe_resource *r600_user_buffer_create(struct 
pipe_screen *screen,
if (rbuffer == NULL) {
return NULL;
}
-   data = radeon_ws_bo_map(rscreen-rw, rbuffer-bo);
+   data = radeon_ws_bo_map(rscreen-rw, rbuffer-bo, 0, NULL);
memcpy(data, ptr, bytes);
radeon_ws_bo_unmap(rscreen-rw, rbuffer-bo);
return rbuffer-base.b;
@@ -137,15 +125,9 @@ static 

Mesa (master): r600g: use malloc bufmgr for constant buffers

2010-09-16 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 189a59751352208cb0386131f9ad82256ec9bed9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=189a59751352208cb0386131f9ad82256ec9bed9

Author: Dave Airlie airl...@redhat.com
Date:   Fri Sep 17 12:51:04 2010 +1000

r600g: use malloc bufmgr for constant buffers

---

 src/gallium/winsys/r600/drm/radeon.c   |7 +++
 src/gallium/winsys/r600/drm/radeon_priv.h  |1 +
 src/gallium/winsys/r600/drm/radeon_ws_bo.c |2 +-
 3 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/gallium/winsys/r600/drm/radeon.c 
b/src/gallium/winsys/r600/drm/radeon.c
index 2135b07..7b88075 100644
--- a/src/gallium/winsys/r600/drm/radeon.c
+++ b/src/gallium/winsys/r600/drm/radeon.c
@@ -20,6 +20,7 @@
 #include unistd.h
 #include string.h
 #include errno.h
+#include pipebuffer/pb_bufmgr.h
 #include xf86drm.h
 #include radeon_priv.h
 #include radeon_drm.h
@@ -125,6 +126,10 @@ struct radeon *radeon_new(int fd, unsigned device)
__func__, radeon-device);
break;
}
+
+   radeon-mman = pb_malloc_bufmgr_create();
+   if (!radeon-mman)
+   return NULL;
return radeon;
 }
 
@@ -143,6 +148,8 @@ struct radeon *radeon_decref(struct radeon *radeon)
if (--radeon-refcount  0) {
return NULL;
}
+
+   radeon-mman-destroy(radeon-mman);
drmClose(radeon-fd);
free(radeon);
return NULL;
diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h 
b/src/gallium/winsys/r600/drm/radeon_priv.h
index 49fe1a6..cb18d15 100644
--- a/src/gallium/winsys/r600/drm/radeon_priv.h
+++ b/src/gallium/winsys/r600/drm/radeon_priv.h
@@ -87,6 +87,7 @@ struct radeon {
struct radeon_stype_info*stype;
unsigned max_states;
boolean use_mem_constant; /* true for evergreen */
+   struct pb_manager *mman; /* malloc manager */
 };
 
 struct radeon_ws_bo {
diff --git a/src/gallium/winsys/r600/drm/radeon_ws_bo.c 
b/src/gallium/winsys/r600/drm/radeon_ws_bo.c
index 422e298..09e379f 100644
--- a/src/gallium/winsys/r600/drm/radeon_ws_bo.c
+++ b/src/gallium/winsys/r600/drm/radeon_ws_bo.c
@@ -12,7 +12,7 @@ struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon,
if (radeon-use_mem_constant  (usage  PIPE_BIND_CONSTANT_BUFFER)) {
desc.alignment = alignment;
desc.usage = usage;
-   ws_bo-pb = pb_malloc_buffer_create(size, desc);
+   ws_bo-pb = radeon-mman-create_buffer(radeon-mman, size, 
desc);
if (ws_bo-pb == NULL) {
free(ws_bo);
return NULL;

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


Mesa (master): r600g: add support for kernel bo

2010-09-16 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: da96313afe3cff66d8ae0c9675a6299b3d7510f9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=da96313afe3cff66d8ae0c9675a6299b3d7510f9

Author: Dave Airlie airl...@redhat.com
Date:   Fri Sep 17 13:18:42 2010 +1000

r600g: add support for kernel bo

this moves to using a pb bufmgr instead of kernel bos directly.

---

 src/gallium/drivers/r600/r600_context.c|7 +
 src/gallium/drivers/r600/radeon.h  |1 +
 src/gallium/winsys/r600/drm/Makefile   |3 +-
 src/gallium/winsys/r600/drm/r600_state.c   |   22 ++--
 src/gallium/winsys/r600/drm/radeon.c   |4 +
 src/gallium/winsys/r600/drm/radeon_bo.c|   16 ++
 src/gallium/winsys/r600/drm/radeon_bo_pb.c |  243 
 src/gallium/winsys/r600/drm/radeon_ctx.c   |   18 ++-
 src/gallium/winsys/r600/drm/radeon_priv.h  |   14 ++-
 src/gallium/winsys/r600/drm/radeon_ws_bo.c |   74 +
 10 files changed, 352 insertions(+), 50 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_context.c 
b/src/gallium/drivers/r600/r600_context.c
index 2ec2554..cca1e35 100644
--- a/src/gallium/drivers/r600/r600_context.c
+++ b/src/gallium/drivers/r600/r600_context.c
@@ -80,6 +80,13 @@ void r600_flush(struct pipe_context *ctx, unsigned flags,
r600_queries_resume(ctx);
 }
 
+void r600_flush_ctx(void *data)
+{
+struct r600_context *rctx = data;
+
+rctx-context.flush(rctx-context, 0, NULL);
+}
+
 struct pipe_context *r600_create_context(struct pipe_screen *screen, void 
*priv)
 {
struct r600_context *rctx = CALLOC_STRUCT(r600_context);
diff --git a/src/gallium/drivers/r600/radeon.h 
b/src/gallium/drivers/r600/radeon.h
index 36bfb74..5f9f21d 100644
--- a/src/gallium/drivers/r600/radeon.h
+++ b/src/gallium/drivers/r600/radeon.h
@@ -212,4 +212,5 @@ enum r600_stype {
 #define R600_QUERY_SIZE1
 #define R600_QUERY_PM4 128
 
+void r600_flush_ctx(void *data);
 #endif
diff --git a/src/gallium/winsys/r600/drm/Makefile 
b/src/gallium/winsys/r600/drm/Makefile
index 86688a2..c81a075 100644
--- a/src/gallium/winsys/r600/drm/Makefile
+++ b/src/gallium/winsys/r600/drm/Makefile
@@ -14,7 +14,8 @@ C_SOURCES = \
radeon_pciid.c \
radeon.c \
r600_drm.c \
-   radeon_ws_bo.c
+   radeon_ws_bo.c \
+   radeon_bo_pb.c
 
 LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/r600 \
   $(shell pkg-config libdrm --cflags-only-I)
diff --git a/src/gallium/winsys/r600/drm/r600_state.c 
b/src/gallium/winsys/r600/drm/r600_state.c
index 82eb0cc..b04885a 100644
--- a/src/gallium/winsys/r600/drm/r600_state.c
+++ b/src/gallium/winsys/r600/drm/r600_state.c
@@ -155,7 +155,7 @@ static int r600_state_pm4_bytecode(struct radeon_state 
*state, unsigned offset,
r = radeon_state_reloc(state, state-cpm4, 
regs[id + i].bo_id);
if (r)
return r;
-   state-pm4[state-cpm4++] = state-bo[regs[id + 
i].bo_id]-bo-handle;
+   state-pm4[state-cpm4++] = 
radeon_ws_bo_get_handle(state-bo[regs[id + i].bo_id]);
}
}
return 0;
@@ -172,7 +172,7 @@ static int r600_state_pm4_bytecode(struct radeon_state 
*state, unsigned offset,
r = radeon_state_reloc(state, state-cpm4, 
regs[id + i].bo_id);
if (r)
return r;
-   state-pm4[state-cpm4++] = state-bo[regs[id + 
i].bo_id]-bo-handle;
+   state-pm4[state-cpm4++] = 
radeon_ws_bo_get_handle(state-bo[regs[id + i].bo_id]);
}
}
return 0;
@@ -220,7 +220,7 @@ static int eg_state_pm4_bytecode(struct radeon_state 
*state, unsigned offset, un
r = radeon_state_reloc(state, state-cpm4, 
regs[id + i].bo_id);
if (r)
return r;
-   state-pm4[state-cpm4++] = state-bo[regs[id + 
i].bo_id]-bo-handle;
+   state-pm4[state-cpm4++] = 
radeon_ws_bo_get_handle(state-bo[regs[id + i].bo_id]);
}
}
return 0;
@@ -237,7 +237,7 @@ static int eg_state_pm4_bytecode(struct radeon_state 
*state, unsigned offset, un
r = radeon_state_reloc(state, state-cpm4, 
regs[id + i].bo_id);
if (r)
return r;
-   state-pm4[state-cpm4++] = state-bo[regs[id + 
i].bo_id]-bo-handle;
+   state-pm4[state-cpm4++] = 
radeon_ws_bo_get_handle(state-bo[regs[id + i].bo_id]);
}
}
return 0;
@@ 

Mesa (master): r600g: add upload manager support.

2010-09-16 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 0d76bb5d4c5c867155f7fb381c46018e1560b790
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d76bb5d4c5c867155f7fb381c46018e1560b790

Author: Dave Airlie airl...@redhat.com
Date:   Fri Sep 17 14:01:50 2010 +1000

r600g: add upload manager support.

this add support for the upload manager for uploading user vbo/index buffers.

this provides a considerable speedup in q3 type games.

---

 src/gallium/drivers/r600/r600_buffer.c   |  183 +++---
 src/gallium/drivers/r600/r600_context.c  |   32 -
 src/gallium/drivers/r600/r600_context.h  |   12 ++
 src/gallium/drivers/r600/r600_draw.c |8 +-
 src/gallium/drivers/r600/r600_resource.h |   31 +
 src/gallium/drivers/r600/r600_state.c|4 +
 6 files changed, 223 insertions(+), 47 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_buffer.c 
b/src/gallium/drivers/r600/r600_buffer.c
index a38c013..dc3fc81 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -29,6 +29,7 @@
 #include util/u_math.h
 #include util/u_inlines.h
 #include util/u_memory.h
+#include util/u_upload_mgr.h
 #include state_tracker/drm_driver.h
 #include r600_screen.h
 #include r600_context.h
@@ -67,66 +68,69 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen 
*screen,
 const struct pipe_resource *templ)
 {
struct r600_screen *rscreen = r600_screen(screen);
-   struct r600_resource *rbuffer;
+   struct r600_resource_buffer *rbuffer;
struct radeon_ws_bo *bo;
/* XXX We probably want a different alignment for buffers and textures. 
*/
unsigned alignment = 4096;
 
-   rbuffer = CALLOC_STRUCT(r600_resource);
+   rbuffer = CALLOC_STRUCT(r600_resource_buffer);
if (rbuffer == NULL)
return NULL;
 
-   rbuffer-base.b = *templ;
-   pipe_reference_init(rbuffer-base.b.reference, 1);
-   rbuffer-base.b.screen = screen;
-   rbuffer-base.vtbl = r600_buffer_vtbl;
-   rbuffer-size = rbuffer-base.b.width0;
-   rbuffer-domain = r600_domain_from_usage(rbuffer-base.b.bind);
-   bo = radeon_ws_bo(rscreen-rw, rbuffer-base.b.width0, alignment, 
rbuffer-base.b.bind);
+   rbuffer-magic = R600_BUFFER_MAGIC;
+   rbuffer-user_buffer = NULL;
+   rbuffer-num_ranges = 0;
+   rbuffer-r.base.b = *templ;
+   pipe_reference_init(rbuffer-r.base.b.reference, 1);
+   rbuffer-r.base.b.screen = screen;
+   rbuffer-r.base.vtbl = r600_buffer_vtbl;
+   rbuffer-r.size = rbuffer-r.base.b.width0;
+   rbuffer-r.domain = r600_domain_from_usage(rbuffer-r.base.b.bind);
+   bo = radeon_ws_bo(rscreen-rw, rbuffer-r.base.b.width0, alignment, 
rbuffer-r.base.b.bind);
if (bo == NULL) {
FREE(rbuffer);
return NULL;
}
-   rbuffer-bo = bo;
-   return rbuffer-base.b;
+   rbuffer-r.bo = bo;
+   return rbuffer-r.base.b;
 }
 
 struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
  void *ptr, unsigned bytes,
  unsigned bind)
 {
-   struct r600_resource *rbuffer;
-   struct r600_screen *rscreen = r600_screen(screen);
-   struct pipe_resource templ;
-   void *data;
-
-   memset(templ, 0, sizeof(struct pipe_resource));
-   templ.target = PIPE_BUFFER;
-   templ.format = PIPE_FORMAT_R8_UNORM;
-   templ.usage = PIPE_USAGE_IMMUTABLE;
-   templ.bind = bind;
-   templ.width0 = bytes;
-   templ.height0 = 1;
-   templ.depth0 = 1;
-
-   rbuffer = (struct r600_resource*)r600_buffer_create(screen, templ);
-   if (rbuffer == NULL) {
+   struct r600_resource_buffer *rbuffer;
+
+   rbuffer = CALLOC_STRUCT(r600_resource_buffer);
+   if (rbuffer == NULL)
return NULL;
-   }
-   data = radeon_ws_bo_map(rscreen-rw, rbuffer-bo, 0, NULL);
-   memcpy(data, ptr, bytes);
-   radeon_ws_bo_unmap(rscreen-rw, rbuffer-bo);
-   return rbuffer-base.b;
+
+   rbuffer-magic = R600_BUFFER_MAGIC;
+   pipe_reference_init(rbuffer-r.base.b.reference, 1);
+   rbuffer-r.base.vtbl = r600_buffer_vtbl;
+   rbuffer-r.base.b.screen = screen;
+   rbuffer-r.base.b.target = PIPE_BUFFER;
+   rbuffer-r.base.b.format = PIPE_FORMAT_R8_UNORM;
+   rbuffer-r.base.b.usage = PIPE_USAGE_IMMUTABLE;
+   rbuffer-r.base.b.bind = bind;
+   rbuffer-r.base.b.width0 = bytes;
+   rbuffer-r.base.b.height0 = 1;
+   rbuffer-r.base.b.depth0 = 1;
+   rbuffer-r.base.b.flags = 0;
+   rbuffer-num_ranges = 0;
+   rbuffer-r.bo = NULL;
+   rbuffer-user_buffer = ptr;
+   return rbuffer-r.base.b;
 }
 
 static void r600_buffer_destroy(struct pipe_screen *screen,
struct pipe_resource *buf)
 {
-   struct r600_resource *rbuffer = (struct 

Mesa (master): r600g: fixup map flushing.

2010-09-16 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 3ddc714b20ac4e28b80c6f88d1993445fff2262c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ddc714b20ac4e28b80c6f88d1993445fff2262c

Author: Dave Airlie airl...@redhat.com
Date:   Fri Sep 17 14:36:18 2010 +1000

r600g: fixup map flushing.

long lived maps were getting removed when they shouldn't this
tries to avoid that problem by only adding to the flush list
on unmap.

---

 src/gallium/winsys/r600/drm/radeon_bo_pb.c |   14 +-
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gallium/winsys/r600/drm/radeon_bo_pb.c 
b/src/gallium/winsys/r600/drm/radeon_bo_pb.c
index df2c649..6cc0f93 100644
--- a/src/gallium/winsys/r600/drm/radeon_bo_pb.c
+++ b/src/gallium/winsys/r600/drm/radeon_bo_pb.c
@@ -39,8 +39,9 @@ static void radeon_bo_pb_destroy(struct pb_buffer *_buf)
 {
struct radeon_bo_pb *buf = radeon_bo_pb(_buf);
 
+   LIST_DEL(buf-maplist);
+
if (buf-bo-data != NULL) {
-   LIST_DEL(buf-maplist);
radeon_bo_unmap(buf-mgr-radeon, buf-bo);
}
radeon_bo_reference(buf-mgr-radeon, buf-bo, NULL);
@@ -57,8 +58,10 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf,
if (p_atomic_read(buf-bo-reference.count)  1)
return NULL;
}
-   if (buf-bo-data != NULL)
+   if (buf-bo-data != NULL) {
+   LIST_DELINIT(buf-maplist);
return buf-bo-data;
+   }
 
if (flags  PB_USAGE_DONTBLOCK) {
uint32_t domain;
@@ -72,13 +75,14 @@ radeon_bo_pb_map_internal(struct pb_buffer *_buf,
if (radeon_bo_map(buf-mgr-radeon, buf-bo)) {
return NULL;
}
-   LIST_ADDTAIL(buf-maplist, buf-mgr-buffer_map_list);
+   LIST_DELINIT(buf-maplist);
return buf-bo-data;
 }
 
 static void radeon_bo_pb_unmap_internal(struct pb_buffer *_buf)
 {
-   (void)_buf;
+   struct radeon_bo_pb *buf = radeon_bo_pb(_buf);
+   LIST_ADDTAIL(buf-maplist, buf-mgr-buffer_map_list);
 }
 
 static void
@@ -218,7 +222,7 @@ void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr)
 
LIST_FOR_EACH_ENTRY_SAFE(rpb, t_rpb, mgr-buffer_map_list, maplist) {
radeon_bo_unmap(mgr-radeon, rpb-bo);
-   LIST_DEL(rpb-maplist);
+   LIST_DELINIT(rpb-maplist);
}
 
LIST_INITHEAD(mgr-buffer_map_list);

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


Mesa (master): r600g: use calloc for ctx bo allocations

2010-09-16 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: d0502297e02074d0b022c1e3e33319829b750a7e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d0502297e02074d0b022c1e3e33319829b750a7e

Author: Dave Airlie airl...@redhat.com
Date:   Fri Sep 17 15:27:58 2010 +1000

r600g: use calloc for ctx bo allocations

since the reference code relies on these being NULL.

---

 src/gallium/winsys/r600/drm/radeon_ctx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c 
b/src/gallium/winsys/r600/drm/radeon_ctx.c
index ca3e40f..7ccb524 100644
--- a/src/gallium/winsys/r600/drm/radeon_ctx.c
+++ b/src/gallium/winsys/r600/drm/radeon_ctx.c
@@ -86,7 +86,7 @@ struct radeon_ctx *radeon_ctx_init(struct radeon *radeon)
radeon_ctx_fini(ctx);
return NULL;
}
-   ctx-bo = malloc(sizeof(void *) * RADEON_CTX_MAX_PM4);
+   ctx-bo = calloc(sizeof(void *), RADEON_CTX_MAX_PM4);
if (ctx-bo == NULL) {
radeon_ctx_fini(ctx);
return NULL;

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